Created on 2006-08-16 20:59 by tinkiwinky, last changed 2006-08-16 21:07 by georg.brandl. This issue is now closed.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2006-08-16 20:59:15 | tinkiwinky | create | |
Created on 2006-08-16 20:59 by tinkiwinky, last changed 2006-08-16 21:07 by georg.brandl. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg29524 - (view) | Author: tinkiwinky (tinkiwinky) | Date: 2006-08-16 20:59 | |
y = ["halo:lol","ich:bin","wir:wareum","galopp:kufladen"]
for i in y:
z = i.split(":")[0]
if z is "wir":
print z, "is wir"
else: print z, "is not wir"
the output from this include: "wir is not wir"
I am using python 2.4.3 on windows xp sp2 german
|
|||
| msg29525 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2006-08-16 21:07 | |
Logged In: YES user_id=849994 Don't use "is" for string comparison. It compares object identity, and while this may work in some cases, it does not in most. Use "==" instead. Closing as Invalid. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2006-08-16 20:59:15 | tinkiwinky | create | |