Reading lines from a file using python
问题 I have a file with almost 100000 lines. I want to make a cleanning process (lower case, remove stopwords etc) However it takes time. Example for 10000 the script needs 15 minutes. For all file I expect to take 150 minutes. However it takes 5 hours. In the start the file use for reading this: fileinput = open('tweets.txt', 'r') lines = fileinput.read().lower() #for lower case, however it load all file for line in fileinput: lines = line.lower() Question: Can I use a way to read the first 10000