操作文件
# coding=utf-8 支持中文
"""
China
Japan
France
England
"""
f = open("record.txt", "a+") # 读写追加
content = f.readline()
print content
content = f.readlines()
print content
f.write('
German')
f.close()
"""
China
Japan
France
England
German
"""
逐行读
# coding=utf-8 支持中文
f = open("record.txt", "r+")
content = f.readline()
while content:
print content
content = f.readline()
f.close()