编码处理
import urllib.request import urllib.parse bianma = '编程' one = urllib.parse.quote(bianma) print(one) two = urllib.parse.quote(one) print(two) three = urllib.parse.quote(two) print(three)
输出结果:
import urllib.request import urllib.parse bianma = '%2525E7%2525BC%252596%2525E7%2525A8%25258B' one = urllib.parse.unquote(bianma) print(one) two = urllib.parse.unquote(one) print(two) three = urllib.parse.unquote(two) print(three)
输出结果如下: