Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyqt string to a normal python string is giving some text appends to the string

When I try to print a PyQT string, it is not converted to a normal string. How can I do it? See the code below.

    def _execute_test(self):
        test_in = str(self.buildFlags.inFlags)
        test_out = str(self.buildFlags.exFlags)
        print(str(test_in))
        print("============")
        print(str(test_out))

The output I get is:

>>> [PyQt4.QtCore.QString(u'Documents'), PyQt4.QtCore.QString(u'New folder')]
like image 278
user2190483 Avatar asked Jul 07 '26 01:07

user2190483


1 Answers

If you want to print a list of string from a list of PyQt4.QtCore.QString try this:

print([str(x) for x in my_qstring_list])
like image 195
Frodon Avatar answered Jul 12 '26 03:07

Frodon