以append模式打开文件,追加的内容都在文件末尾,如果我想从文件头开始追加内容,并不刷掉原来的数据,应该如何做?
robot.txt:
---------------------------------分割线内为robot.txt实际内容------------------------------
222
333
444
555
---------------------------------分割线内为robot.txt实际内容------------------------------
现在想在文件头中追加"111",应该怎么做使robot.txt变成:
robot.txt:
---------------------------------分割线内为robot.txt实际内容------------------------------
111
222
333
444
555
---------------------------------分割线内为robot.txt实际内容------------------------------
_______________________________________________
python-chinese
Post: send
python-chinese@...
Subscribe: send subscribe to
python-chinese-request@...
Unsubscribe: send unsubscribe to
python-chinese-request@...
Detail Info:
http://python.cn/mailman/listinfo/python-chinese