Metamorphosis
RSS feed

Python如何输出包含在对象中的中文字符?

def zhprint(obj):
import re
print re.sub(r"\\u([a-f0-9]{4})", lambda mg: unichr(int(mg.group(1), 16)), obj.__repr__())



yeah it's a hack but it works (for most cases)...
原发布于 https://www.zhihu.com/question/20413029/answer/15064222


published 10 Aug 2012
blog comments powered by Disqus