python读取txt大文件

Posted 一杯明月

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python读取txt大文件相关的知识,希望对你有一定的参考价值。

直接上代码:

技术分享图片
import easygui
import os
s4 = []
s6 = []
path = easygui.fileopenbox()
if path:
    b = os.path.splitext(path)
    c = [b[0], _trace, .xyz]
    d = ‘‘.join(c)
    with open(d, w+) as f1:
        with open(path, r, encoding=utf-8) as f:
            for line in f:
                s1 = line.strip()
                s2 = (s1.strip().split( )[-6:-3][::-1])
                s3 =  .join(s2)
                f1.writelines(s3)
                f1.writelines(
)
View Code

 

以上是关于python读取txt大文件的主要内容,如果未能解决你的问题,请参考以下文章