1
billlee 2015-05-16 18:08:26 +08:00
print(soup.title.text.decode('编码方案'))
|
2
omengye 2015-05-16 18:09:55 +08:00
soup = BeautifulSoup(response.text.encode('utf-8'))
|
5
onsfhg OP 奇怪,运行出错,修改一下在 python2.7上没出错
|
6
omengye 2015-05-16 20:44:59 +08:00
@onsfhg 这应该是一个输出的问题。如果你是在windows cmd里尝试输出utf-8,需要先将cmd代码页设置为utf-8
|
7
imn1 2015-05-16 20:50:29 +08:00
cmd + enter
chcp 65001 + enter run... |
8
killpanda 2015-05-16 21:11:24 +08:00 via iPhone
soup = BeautifulSoup(response.text, from_encoding='foo')
|