urllib.quote_plus()相当于JavaScrip

2024-03-29 11:15:34 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试从Python移植一段代码:

my_input = "this&is£some text"
encoded_input = urllib.quote_plus(str(my_input))

…到JavaScript:

^{pr2}$

微小的区别是urllib.quote_plus()将把空格转换成{},而不是{}(link)。 只是想知道是否有人能提供一些想法。 目前正在进行。。。在

var my_input = "this&is£some text";
encoded_input = encodeURIComponent(my_input).replace(/%20/g,'+');

Tags: 代码textinputismyplussomeurllib