python-读取txt文本
import tensorflow as tf import os with open('test_read.txt', 'r') as file: lines = file.readlines() nlines = len(lines) for i, text in enumerate(lines): print(i,text)
原文
dao ke dao fei chang dao ming ke ming fei chang ming laozi 2018.09.10
输出结果
0 dao ke dao 1 fei chang dao 2 ming ke ming 3 fei chang ming 4 5 laozi 6 2018.09.10 7 8