python2 爬取网页时 遇到需要对地址编码的

http%3A//www.myctvs.com/blog 1.html 类似与这种中间空了一个空格,在html中显示是没有问题的,但是实际的地址 是:
http%3A//www.myctvs.com/blog%201.html -->>这样的是有问题的
可以访问的地址是-->>
"
https//www.myctvs.com/blog%201.html
"
直接访问 带空格的会出错,找不到这个网页,需要进行url编码
import urllib
URL = urllib.quote(“需要编码的地址”)
print(URL)
>>>http%3A//www.myctvs.com/blog%201.html
原文地址:https://www.cnblogs.com/guanong/p/10931479.html