I want to see if a certain word is in a text file, how do I go about that?
sneekula
969
Nearly a Posting Maven
Recommended Answers
Jump to PostI want to see if a certain word is in a text file, how do I go about that?
you can read in line by line
for line in open("file"): if "word" in line: do_something(line)
you can read in one whole chunk
data = …
All 3 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.