开发者

problem with urlopen

This code used to print out a web page. It now prints a single space, even though that page clearly has con开发者_如何学Ctent when viewed in a browser

from urllib.request import urlopen
f = urlopen('http://online.wsj.com/mdc/public/page/2_3020-tips.html?mod=topnav_2_3000')
page = f.read()
f.close()
print('*', page.decode(), '*')

This started when I upgraded from 3.2 to 3.2.1, but that could just be a coincidence

What obvious thing am I missing?


It works in Python 3.1 and Python 3.2, but not Python 3.2.1 (it returns an empty string).

EDIT: I've reported it in the Python-Dev list.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜