Python file read by word | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python file read by word

How to read my text file by word in python

15th Jan 2020, 6:45 PM
ярослав данилюк
ярослав данилюк - avatar
5 Answers
+ 6
1. open file with open(...) within a for loop that reads one line 2. take this line and split it to a list 3. iterate through this list so you get each word, and do what you need
15th Jan 2020, 7:24 PM
Lothar
Lothar - avatar
17th Jan 2020, 10:06 AM
Lothar
Lothar - avatar
+ 1
Program should contain less number of steps
16th Jan 2020, 5:38 PM
Bathri Narayanana .M
Bathri Narayanana .M - avatar
0
by word
15th Jan 2020, 6:52 PM
ярослав данилюк
ярослав данилюк - avatar