标签:lin python res bsp nbsp blog 简单 imp list
在python2.x版本中可以直接使用import urllib来进行操作,但是python3.x版本中使用的是import urllib.request来进行操作,下面是简单的例子:
python2.x
import urllib url = ‘http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345‘ text = urllib.urlopen(url).read()
python3.x
import urllib.request url = ‘http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=‘ current = ‘12345‘ response = urllib.request.urlopen(url+current) text = response.read() current = text[-5:] response = urllib.request.urlopen(url+current)
python3.x 和 python2.x关于 urllib的用法
标签:lin python res bsp nbsp blog 简单 imp list
原文地址:http://www.cnblogs.com/nucdy/p/6636870.html