AttributeError

Ajay Brar abra9823 at mail.usyd.edu.au
Mon Jun 28 10:51:35 EDT 2004


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'

the trace is
bash$ python
Python 2.3.4 (#3, May 28 2004, 13:31:19)
[GCC 2.95.2 19991024 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> contextForm = {"contextName":"test2","contextDescription":"test22","number":"1","contextName1":"test1","contextDescription1":"test11"}
>>> if contextForm.has_key("number"):
...     num=contextForm["number"].value
...
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
AttributeError: 'str' object has no attribute 'value'

any ideas why it isn't working?

thanks

Ajay Brar
CS Honours 2004
Smart Internet Technology Research Group

http://www.it.usyd.edu.au/~abrar1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040629/b0ad9fbb/attachment.html>


More information about the Python-list mailing list