我的python 是2.7版
是用beautifulsoup 去抓网页资料
抓到了table里面的值
例如 a[2]= <td> 雅虎新闻 Yahoo news </td>
a[3]= <td> 四 thr </td>
我也透过 a[2]=a[2].get_text()
把tag给去掉
只留下 text的部分
若我现在 print a[2],a[3]
结果: 雅虎新闻 Yahoo news 四 thr
但现在问题是
若我设一个 newslist=[]
再把 newslist.append(a[2])
newslist.append(a[3])
在print newslist
结果会变成 中文字是乱码
英文是正常的
单独印出那个位置的时候 正常
printf newslist[0] 会显示 雅虎新闻 Yahoo news
printf newslist 会变成 u'\u4eda\u623f\u4eds\ Yahoo news u'\u4dsw thr
上面编码是我乱打的但会是这样的情况
要印出整个list 或是dict 就会乱乱的
故发文求解惑
谢谢大家