python 按行读取文件和拆分数据

Posted

tags:

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

# Read files and split data by line
def readFile (filename):
    info = []
    with open(filename, 'r') as openFile:
        data = openFile.readlines()
        for line in data:
            info.append(line.split())
    return info

以上是关于python 按行读取文件和拆分数据的主要内容,如果未能解决你的问题,请参考以下文章