"""
URL只允许一部分ASCII字符,其他字符(如汉字)是不符合标准的,此时就要进行编码
"""
import string
import urllib.parse
keys = '逆向'
keys_str = urllib.parse.quote(keys, safe=string.printable)
print(keys_str)
keys_str_ = ''
for i in keys_str.split('%'):
if len(i):
keys_str_ += ('%25' + i)
print(keys_str_)
"""
%E9%80%86%E5%90%91
%25E9%2580%2586%25E5%2590%2591
...
https://search.51job.com/list/030000,000000,0000,00,9,99,%25E9%2580%2586%25E5%2590%2591,2,1.html?lang=c&stype=&postchannel=0000&workyear=99&cotype=99°reefrom=99&jobterm=99&companysize=99&providesalary=99&lonlat=0%2C0&radius=-1&ord_field=0&confirmdate=9&fromType=&dibiaoid=0&address=&line=&specialarea=00&from=&welfare=
https://s.gxrc.com/sJob?schType=1&page=1&pageSize=20&orderType=0&listValue=1&keyword=%E9%80%86%E5%90%91
"""