[Python-de] abfrage: Wert == [None] ???
Frank Immich
frankimmich at gmx.de
Die Nov 9 14:39:51 CET 2004
Hallo zusammen,
eine Frage zu einer Abfrage:
Ich weise in einem dictionary einem Schluessel den
Wert [None] zu. Nun möchte ich abfragen ob der Wert = [None].
Das funktioniert aber irgendwie nicht...?
.........
d_msn = ....
print d_msn
for p,c in d_msn.items():
print "p:",p
print "c:",c
print "type c", type(c)
print "type c[0]", type(c[0])
if c == [None]:
print "Fall1:", p
if c == ["None"]:
print "Fall2:", p
if c == "[None]":
print "Fall3:", p
if c == None:
print "Fall3:", p
if types.NoneType in c:
print "Fall4:", p
if c[0] == types.NoneType:
print "Fall5:", p
ergbnis:
{'1': [None]}
p: 1
c: [None]
type c <type 'list'>
type c[0] <type 'NoneType'>
und das wars... wie kann ich das abfragen ? Wo ist mein Denkfehler ?
Vielen Dank für einen Tipp
Grüße Frank
--
NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
GMX DSL-Netzanschluss + Tarif zum supergünstigen Komplett-Preis!