I'm trying to prep some data for a designer. I'm pulling data out of SQL Server with python on a Windows machine (not sure if OS is important). How would I make the string 'Official Trademark™' = 'Official Trademark'? Also, any further information/reading on unicode or the pertinent subject matter would help me become a little more independent. Thanks for any help!
Edited:
Perhaps I should have included some code. I'm now getting this error during run time: 'UnicodeDecodeError: 'ascii' codec can't decode byte 0x99 in position 2:ordinal not in range(128).' Here is my code:
row.note = 'TM™ Data\n'
t = row.no开发者_如何学Cte
t = t.rstrip(os.linesep).lstrip(os.linesep)
t = t.replace(u"\u2122",'')
The trademark symbol is Unicode character U+2122
, or in Python notation u"\u2122"
.
Just do a search and replace:
'string'.replace(u"\u2122", '')
>>> 'Official Trademark™'.strip('™')
'Official Trademark'
>>>
精彩评论