1.Python3 解析url
示例代码:
#!/usr/bin/python
from urllib.parse import urlparse
result = urlparse('https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_1732005×××513653986%22%7D&n_type=0&p_from=1');
print(result);
print(result[0]);
print(result.path);
示例截图:
运行截图: