在Python 3中如何进行URL编码?

13 浏览
0 Comments

在Python 3中如何进行URL编码?

我尝试按照文档的说明进行操作,但无法在Python 3中使用urlparse.parse.quote_plus()

from urllib.parse import urlparse
params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'})

我得到以下错误:

AttributeError: 'function' object has no attribute 'parse'

0