0.
1.參考
https://docs.python.org/3/library/urllib.html
urllib
is a package that collects several modules for working with URLs:
urllib.request
for opening and reading URLsurllib.error
containing the exceptions raised byurllib.request
urllib.parse
for parsing URLsurllib.robotparser
for parsingrobots.txt
files
HOWTO Fetch Internet Resources Using The urllib Package
Python同時兼容python2和python3的8個技巧分享
D:\Python36\Tools\scripts>python3 2to3.py "G:\xxx.py"
僅輸出變化,加 -w 則備份和生成替換文件
https://docs.python.org/3/howto/pyporting.html Porting Python 2 Code to Python 3
google:urllib compatible python3
Cheat Sheet: Writing Python 2-3 compatible code
Supporting Python 2 and 3 without 2to3 conversion
Targeting python 2 and 3 at the same time.
2.
3.