I've tried everything but the unicode just doesn't go away.
col = "[u'$929.95']"
unicoded_item = to_unicode(col) # [u'test']
print type(unicoded_item) # <type 'unicode'>
if isinstance(unicoded_item, unicode):
unicoded_item = unicoded_item.encode('utf8')
print str(unicoded_item) # [u'test']
I expected the whole [u' and '] to disappear but it just doesn't seem to convert. So when I save this string to a text file, the text file will literally have all the unicode python character [u'test'] is literally written instead of test
[u'test']oru'test'?print(col[0])? Atortest?[u'test']type(unicoded_item); when you didunicoded_item = to_unicode(col), it took the str representation of a list and then converted that to unicode. If you dotype(col)you'll get the correct type.