Python 文件内容读取
1 # 读取数据的函数 2 def readData(filename): 3 with open(filename, 'r') as f: 4 data = f.read().lower() 5 data = list(data.split()) 6 return data 7 words = readData('deng.txt') 8 print (words) 9 print ('File size is {}'.format(len(words)))
时刻记着自己要成为什么样的人!