有一次发现自己输入的url中含有中文的时候,他会转化为%XXXX的格式。

于是想怎么把他给转换回去,于是使用了urllib库

#-*-coding:utf8 -*-
import urllib
url = " www.baidu.com%253a80%25e6%258f%25a1%25e6%2589%258b%25e6%2588%2590%25e5%258a%259f%253b"
_de_code= urllib.unquote(url)
de_code = urllib.unquote(_de_code).decode("utf8")
print de_code



输出结果
www.baidu.com:80握手成功;

相关文章:

  • 2021-10-05
  • 2022-01-07
  • 2022-01-04
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-07-03
猜你喜欢
  • 2021-10-03
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2021-12-07
相关资源
相似解决方案