通过创建一个file类的对象来打开一个文件,分别使用file类的read.readline或write方法来读写文件. 最后调用一个close方法来告诉Python我们完成了对文件的使用. poem='''\ programming is fun When the work is done if you wanna make your work also fun: use Python! ''' f=file('poem.txt','w') f.write(poem) f.close() f=f…