Python3 解析url

发布时间:2019-09-27 07:10:22编辑:auto阅读(2291)

    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);

    示例截图:

    1.png

    运行截图:

    2.png

    QQ截图20181112131244.png

关键字