【51Job数据爬取日志】【小知识点】前程无忧URL编码处理的代码

 以下代码直接粘贴复制到Pycharm中即可使用。

import urllib.parse

class ChangeUrl_job():
    """
    全然当做是小程序,用来解码与编码51job网站的url。
    """
    def unquoteCode(self,url_param):
        url_param = urllib.parse.unquote(url_param)
        final_url_param = urllib.parse.unquote(url_param)
        return final_url_param

    def quoteCode(self,url_param):
        url_param = urllib.parse.quote(url_param)
        final_url_param = urllib.parse.quote(url_param)
        return final_url_param

if __name__ == "__main__":
    mgramer = ChangeUrl_job()
    url = "https://search.51job.com/list/010000%252C160200,000000,0107%252C0137,01%252C37,9,99,Java%25E5%25BC%2580%25E5%258F%2591%25E5%25B7%25A5%25E7%25A8%258B%25E5%25B8%2588,2,1.html?"
    value = mgramer.unquoteCode(url)
    print(value)


 

你可能感兴趣的:(python毕业设计)