难道我的 py 和你们的不一样?
資深大佬 : h175h32 2
为啥我执行这个
import urllib.parse print(urllib.parse.urlencode("中文"))
都报错?
大佬有話說 (13)
为啥我执行这个
import urllib.parse print(urllib.parse.urlencode("中文"))
都报错?
python 里 urlencode 和 quote/quote_plus 本身使用没变过, 一直是那样, 我怀疑你把 php 的 urlencode 给记叉了….
只是 2.7 时 urlencode 、quote/quote_plus 是在 urllib 下面, 原本的 urlparse 更侧重解析 url, 现在统一移到了 urllib.parse 下面
print(urllib.parse.quote(“中文”))
%E4%B8%AD%E6%96%87