如何在python中将整个文件读入列表?(How to read the entire file into a list in python?)
我想将整个文件读入python列表,任何人都知道如何?
I want to read an entire file into a python list any one knows how to?
最满意答案
print "\nReading the entire file into a list." text_file = open("read_it.txt", "r") lines = text_file.readlines() print lines print len(lines) for line in lines: print line text_file.close() print "\nReading the entire file into a list." text_file = open("read_it.txt", "r") lines = text_file.readlines() print lines print len(lines) for line in lines: print line text_file.close()如何在python中将整个文件读入列表?(How to read the entire file into a list in python?)我想将整个文件读入python列表,任何人都知道如何?
I want to read an entire file into a python list any one knows how to?
发布评论