On Nov 29, 1:53 pm, [EMAIL PROTECTED] wrote:
> I dont understand why the following code cannot find the
> variable "tree".
>
> fname = open("test43.in")
> var = 'tree'
>
> for item in fname:
This will include the EOL character for each line.
Try adding the following line here:
item = item.strip()
> print "item: ", item,
This would have been more obvious without the trailing ',' which
suppresses a new-line being added when printing.
> if item == var:
> print "found tree: ", item,
--
http://mail.python.org/mailman/listinfo/python-list