1.打开文件,得到文件句柄并赋值个一个变量
2.通过句柄对文件进行操作
3.关闭文件
f = open('testfile') data = f.read() print(data) f.close()