链接可能由于种种原因失效,本文记录 Python 验证链接有效性的方法。
request {#request}
返回结果:
- 有效链接:
- 失效链接:
urllib URL can't contain control characters. {#urllib-URL-can’t-contain-control-characters}
-
错误:
urllib URL can't contain control characters.
其中
your_url
中不能包含空格等字符 -
解决方案:用
%20
替换空格
参考资料 {#参考资料}
- https://blog.csdn.net/haiyi_guo/article/details/98619536
- https://blog.csdn.net/KaliWalker/article/details/104216705
文章链接:
https://www.zywvvd.com/notes/coding/python/valid-url/valid-url/