Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python urllib.encode@symbol?_Python - Fatal编程技术网

Python urllib.encode@symbol?

Python urllib.encode@symbol?,python,Python,httplib()的Python文档显示了 urllib.urlencode参数键前面带有@符号。我在其他例子中看不到这一点。在这种情况下,@符号在做什么 >>> import httplib, urllib >>> params = urllib.urlencode({'@number': 12524, '@type': 'issue'}) >>> headers = {"Content-type": "application/x-www-

httplib()的Python文档显示了 urllib.urlencode参数键前面带有
@
符号。我在其他例子中看不到这一点。在这种情况下,@符号在做什么

>>> import httplib, urllib
>>> params = urllib.urlencode({'@number': 12524, '@type': 'issue'})
>>> headers = {"Content-type": "application/x-www-form-urlencoded",
...            "Accept": "text/plain"}
>>> conn = httplib.HTTPConnection("bugs.python.org")
>>> conn.request("POST", "", params, headers)

如您所见,它没有任何意义:

>>> import httplib, urllib
>>> params = urllib.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})
>>> print params
'%40action=show&%40number=12524&%40type=issue'
>>> params = urllib.urlencode({'number': 12524, 'type': 'issue', 'action': 'show'})
>>> print params
'action=show&type=issue&number=12524'

它只是将特殊字符
@
格式化为
%40
,作为
POST
键使用,他们使用它的原因是该站点引擎内部的…

,因为bug追踪器需要
@number
等。。。作为参数,它们需要转义。。。?如果你是这个意思的话,那没有什么特别的意义?我就是这个意思。。。谢谢