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()
收藏
0人收藏
- 2016-08-19 16:23:52Adding Line Numbers to a Python Script by 西国の海妖
- 2016-09-22 11:48:20Define class to deal with files by 阿明娃儿
- 2016-10-14 16:12:39Change Dir by 大猪
- 2017-01-06 09:11:02Loop through header information in a ZIP file by 阮小七
- 2017-03-06 13:52:33File read(n) by 张宋付
- 2013-06-05 13:21:25python 使用MySQLdb连接mysql by 玉开Sir
- 2016-03-02 17:30:47Define file open and read in a function by Solon.Ring
- 2016-05-30 17:05:00Read a file line by line and check line separator by 蟋蟀MM
- 2016-08-19 16:33:13Writes the contents of string to the file by jack.chen
- 2017-03-06 14:11:51Looping Over Characters with read by 风云轩
- 2015-01-07 20:33:07python使用 glob 获得文件列表 by 蟋蟀MM
相关聚客文章