url请求
使用内置urllib:
import urllib.request, urllib.parse, urllib.error fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt') for line in fhand: print(line.decode().strip())
第三方类库requests:
https://requests.readthedocs.io/
使用内置urllib:
import urllib.request, urllib.parse, urllib.error fhand = urllib.request.urlopen('http://data.pr4e.org/romeo.txt') for line in fhand: print(line.decode().strip())
第三方类库requests:
https://requests.readthedocs.io/