Two issues regarding script. You have a typo on the file you are trying to open.
It is listed with a file extension of .in when it should be .ini .
The next issue is that you are comparing what was read from the file
versus the variable.
The item read from file also contains and end-of-line character so
they will never match.
To get around this:
#!/usr/bin/python
fname = open("test43.ini")
var = 'tree'
for item in fname:
print "item: ", item,
if (item.rstrip("\n") == var):
print "found tree: ", item,
else:
print "No tree found"
David wrote: Il Fri, 28 Nov 2008 19:47:01 -0800 (PST), [EMAIL PROTECTED] ha scritto: |
-- http://mail.python.org/mailman/listinfo/python-list
