dealing with special characters in Python and MySQL

Fredrik Lundh fredrik at pythonware.com
Mon Dec 18 03:01:12 EST 2006


ronrsr wrote:

> now, I can't do any string operations, I get the error msg:
> 
> descriptor 'lower' requires a 'str' object but received a 'unicode'
>       args = ("descriptor 'lower' requires a 'str' object but received
> a 'unicode'",)

what's a "string operation" in this context?  are you trying to call 
string methods by explicit calls to class methods in the str class:

 >>> str.upper(u"foo")
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: descriptor 'upper' requires a 'str' object but received a 
'unicode'

instead of calling methods on the string object:

 >>> u"foo".upper()
u'FOO'

?  if so, what did you get that idea from?

</F>




More information about the Python-list mailing list