先放代码:
#!/usr/bin/python2.7
#coding:utf8
path = '/home/python_learning/nickname.list'
with open(path) as fin:
for line in fin.readlines():
print line.decode('string-escape')
'/home/python_learning/nickname.list'内容大约是:
\346\261\237\350\245\277\347\224\265\344\277\241
\345\271\277\345\217\221\351\223\266\350\241\214
真没想到用string-escape转为文字啊