newbie question: if var1 == var2:
Mike Howard
mike at clove.com
Sat Nov 29 10:30:08 EST 2008
More information about the Python-list mailing list
Sat Nov 29 10:30:08 EST 2008
- Previous message (by thread): newbie question: if var1 == var2:
- Next message (by thread): newbie question: if var1 == var2:
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
item = "tree\n" != 'tree' joemacbusiness at gmail.com wrote: > Hi All, > > I dont understand why the following code never finds "tree". > I could not find the answer in the Python tutorials. > Here is the code, test43.in, and runtime: > > #!/usr/bin/python > > fname = open("test43.in") > var = 'tree' > > for item in fname: > print "item: ", item, > if item == var: > print "found tree: ", item, > [jmccaughan at dhcppc2 work]$ > [jmccaughan at dhcppc2 work]$ > [jmccaughan at dhcppc2 work]$ cat test43.in > car > tree > house > pool > dog > cat > wax > candy bar > [jmccaughan at dhcppc2 work]$ python test43.py > item: car > item: tree > item: house > item: pool > item: dog > item: cat > item: wax > item: candy bar > > Thanks, joemacbusiness at gmail.com > > -- > http://mail.python.org/mailman/listinfo/python-announce-list > > Support the Python Software Foundation: > http://www.python.org/psf/donations.html > >
- Previous message (by thread): newbie question: if var1 == var2:
- Next message (by thread): newbie question: if var1 == var2:
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list