Can someone help me ? Please 😐 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Can someone help me ? Please 😐

Can I use for loops to get a word from a text like : file called "hello.txt" ( just writes hello or hey there 😑 ) can i find a word in it's text and edit it using for loops like for "hello" in "hello.txt": print("hey there")

7th Oct 2017, 4:22 PM
warlord
warlord - avatar
2 Answers
+ 6
@Carlos Andrés Hidalgo Martí but how I tried to use the readlines with for loops like for "hello" in file.readlines
7th Oct 2017, 6:45 PM
warlord
warlord - avatar
+ 1
Of course, you should review the file writing and reading part of the python course, there it is.
7th Oct 2017, 6:18 PM
Carlos Hidalgo
Carlos Hidalgo - avatar