AttributeError
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Mon Jun 28 11:15:17 EDT 2004
Ajay Brar wrote:
> hi!
>
> i have the following code that doesn't work
> contextForm =
> {"contextName":"test2","contextDescription":"test22","number":"1","contextName1":"test1","contextDescription1":"test11"}
>
> if contextForm.has_key("number"):
> num=contextForm["number"].value
>
> the error i get is
> AttributeError: 'str' object has no attribute 'value'
What do you want to retrieve? If you want to get the string "1" which is
assigned to the key "number", a simple contextForm["number"] is enough.
If you want to get the integer 1 in the string, use
int(contextForm["number"]).
Reinhold
--
Wenn eine Linuxdistribution so wenig brauchbare Software wie Windows
mitbrächte, wäre das bedauerlich. Was bei Windows der Umfang eines
"kompletten Betriebssystems" ist, nennt man bei Linux eine Rescuedisk.
-- David Kastrup in de.comp.os.unix.linux.misc
More information about the Python-list
mailing list