0
Hey! How do I use split() to get words from a text file?
Tuple
3 odpowiedzi
+ 3
You get the text from the file and split like so.
words = text.split()
+ 2
Please always tag the language you're asking about.
https://code.sololearn.com/W3uiji9X28C1/?ref=app
+ 1
with open('file patht','r') as f:
for line in f:
for word in line.split():
print(word)
f.close()