from urllib import parse url =‘https://www.baidu.com/s?wd=%E5%A4%A7%E9%B1%BC%E6%B5%B7%E6%A3%A0’ new_url=parse.unquote_plus(url) new_url=urllib.parse.quote(url)