Qstrings to Strings

David Boddie david at boddie.org.uk
Thu Sep 3 16:14:24 EDT 2009


On Thursday 03 September 2009 21:01, Stefan Behnel wrote:

> Helvin wrote:
>> Just wanted to say, to convert qstrings (or integers for that matter)
>> to strings, use the str() function.
>> 
>> http://learnwithhelvin.blogspot.com/2009/09/qstrings-and-strings.html
> 
> Hmmm, will that return a Unicode string? A byte string would be rather
> inappropriate in most cases. I guess the unicode() function is the right
> thing to use here (or the str() function in Py3 - no idea if that's
> supported by Qt by now).

PyQt4.5 supports Python 3, so I imagine that str() will be what you would
use with that combination. For Python 2, unicode() is probably what most
people want.

David



More information about the Python-list mailing list