可以使用 python 的 csv 模块来实现。 首先,打开 txt 文件并读取其中的内容: with open('input.txt', 'r') as f: lines = f.readlines()