andrew.arobert at gmail.com
Mon Jun 19 23:18:26 CEST 2006
Saint Malo wrote:
> I am new to programming, and I've chosen python to start with. I wrote
> a simple program that asks several questions and assings each one of
> them a variable via raw_input command. I then combined all the
> variables into one like this a = b + c + d. After this I wrote these
> values to a file. What I want to do now is be able to search through
> the file for any data in there. Is this possible?
It depends on how you want to treat the read data.
# Open a file for read
# Read each line in file
for line in file
#Search each line
if "A" in line:
print "I found A"
More information about the Python-list