我想忽略下面代码中的转义字符。
>>> a=['\%']
>>> print a
['\\%']
我想输出像['\%']
。有什么办法吗?
最佳答案
使用string_escape
、unicode_escape
编码(参见Python Specific Encodings):
>>> a = ['\%']
>>> print str(a).decode('string_escape')
['\%']
>>> print str(a).decode('unicode_escape')
['\%']
关于python - 如何忽略转义\python 列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20658032/