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

9 Years
Discussion Span
Last Post by Stefano Mtangoo

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'}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.