[PyQt] how to covert an object text to string?

Roberto Alsina ralsina at kde.org
Mon Apr 6 13:46:31 BST 2009

klia writes:

> hey guys
> This is in Pyqt
> I have this code
> filename=os.path.basename(self.lwitem.text())
> which self.lwitem.text() holds my filename path but i wanna convert it into
> a string how am i gonna do that??

You mean self.lwitem.text() is a QString and want to convert it to a string?


But you probably want to convert it to unicode instead using unicode()

More information about the PyQt mailing list