I have Dictionary that I update time after time and the dictionary result get inserted to the wxListCtrl in report mode. The problem comes when I insert new data. It seems that the unicode character (u') is also get inserted as part of data. Is there any way to strip it out?

I wanted to doit with .strip("u") but I'm afraid it will strip all U's in my data. Is there a way out

Thanks all

Recommended Answers

All 4 Replies

I think i solved this problem once by just going str(stringvar) . Im not quite sure if it definitley works.. it might have been something else.

The str() function returns a normal string. Test it out:

s = u"a unicode string"

d = {}
d['a'] = s

print(d)  # {'a': u'a unicode string'}

d['b'] = str(s)  # str() converts s to a normal string

print(d)  # {'a': u'a unicode string', 'b': 'a unicode string'}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.