我正在尝试在提交之前对该字符串进行 urlencode。
queryString = 'eventName=' + evt.fields["eventName"] + '&' + 'eventDescription=' + evt.fields["eventDescription"];
Python 2
您正在寻找的是urllib.quote_plus:
safe_string = urllib.quote_plus('string_of_characters_like_these:$#@=?%^Q^$')
#Value: 'string_of_characters_like_these%3A%24%23%40%3D%3F%25%5EQ%5E%24'
Python 3
在 Python 3 中,urllib
封装已被分成更小的组件。你会使用urllib.parse.quote_plus(注意parse
子模块)
import urllib.parse
safe_string = urllib.parse.quote_plus(...)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)