from urllib.request import urlopen
def f1(url):
def f2():
# print(url)
print(urlopen(url).read())
return f2
f=f1("%s%s"%("http://",input("输入你要爬得网站:"))) #例如输入-->www.baidu.com
f()
原文:http://www.cnblogs.com/mrpengfei/p/6716266.html