#coding=utf-8 member=["小","大","小"] print(member) print("小打小闹")
结果为:['\xe5\xb0\x8f', '\xe5\xa4\xa7', '\xe5\xb0\x8f']小打小闹
问:怎么解决列表输出的编码问题
print str(member).decode('string_escape')
can be solved
When outputting a list, the elements inside are processed according to %r (call __repr__()). When outputting str, they are processed according to %s (call __str__()). So, if you want to see Chinese in the list, just:
for i in member: print i
can be solved
When outputting a list, the elements inside are processed according to %r (call __repr__()). When outputting str, they are processed according to %s (call __str__()). So, if you want to see Chinese in the list, just: