请求以python中的连字符开头的Web

时间:2014-05-15 15:52:19

标签: python url ubuntu urllib2 wget

的Python

我需要用python请求一些网址。我使用标准的urllib2 procdeure,例如:

urllib2.urlopen('http://google.com')

没问题。但是,当使用以破折号开头的URL时,例如:

urllib2.urlopen('http://-cityoflove.tumblr.com/')

脚本代码错误:

urllib2.URLError: <urlopen error [Errno -2] Name or service not known>

有没有人可以通过python获取域名?

Ubuntu的

如果可以提供帮助,请注意 wget 发生同样的错误:

wget http://-cityoflove.tumblr.com/

崩溃时出错:

wget: unable to resolve host address `-cityoflove.tumblr.com'

请注意,此错误会在ubuntu错误上通知:https://bugs.launchpad.net/ubuntu/+source/resolvconf/+bug/668926

0 个答案:

没有答案
相关问题