user2190483
user2190483

Reputation: 267

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')]

Upvotes: 3

Views: 7701

Answers (1)

Frodon
Frodon

Reputation: 3775

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])

Upvotes: 6

Related Questions