0
在以下代码中,raw
和want
都是1,但它们在计算机中不同。我想将raw
转换为want
。我有很多这样的strs,我怎样才能在Python中转换它们?'1' - >'1',如何将左str转换为右str
raw = '1'
want = '1'
print(ord(raw)) # 65297
print(ord(want)) # 49
在以下代码中,raw
和want
都是1,但它们在计算机中不同。我想将raw
转换为want
。我有很多这样的strs,我怎样才能在Python中转换它们?'1' - >'1',如何将左str转换为右str
raw = '1'
want = '1'
print(ord(raw)) # 65297
print(ord(want)) # 49
'ord(raw.strip())'? –
[将unicode表示的数字转换为ascii字符串]可能重复(https://stackoverflow.com/questions/25313773/convert-unicode-representation-of-number-to-ascii-string) –
以下url解决了我的问题。谢谢。 http://www.cnblogs.com/kaituorensheng/p/3554571.html –