文件 利用Python处理文件非常简单,打开文件进行读取或写入,需要使用内建函数open和绝对、相对路径。 path='./example.txt' f=open(path) lines=[x.rstrip() for x in open(path)] In [10]: lines Out[10]: ['good morning', 'good afternoon', 'good evening&