#写入文件
filename = './data/programming.log'
with open(filename, 'w') as file_object:file_object.write('I love programming.\n')file_object.write('I love creating new games.\n')#附加到文件
filename = './data/programming.log'
with open(filename, 'a') as file_object:file_object.write('I aslo love finding meaning in large datasets.\n')file_object.write('I love creating apps that can run in a brower.\n')