I've taken a look to urlparse.urlparse
method documentation and I'm a little bit confused about what is the parameters
part (not to be confused with the more familiar query
part, that is what goes after the question mark and before the fragment part).
我已经看了一下urlparse.urlparse方法文档,我对参数部分有点困惑(不要与更熟悉的查询部分混淆,这就是问号之后和片段之前的内容)部分)。
Wikipedia entry on URL's structure doesn't say anything about that, so could please anybody elaborate a little bit on this and possibly give some examples?
关于URL结构的*条目没有说明这一点,所以可以请任何人详细说明这一点并可能举一些例子吗?
2 个解决方案
#1
21
fascinating, this is the first time I've encounter them, found this
http://doriantaylor.com/policy/http-url-path-parameter-syntax I also found this http://tools.ietf.org/html/rfc3986#section-3.3 (last paragraph before query) and this http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
很有趣,这是我第一次遇到它们,发现这个http://doriantaylor.com/policy/http-url-path-parameter-syntax我也找到了这个http://tools.ietf.org/html/ rfc3986#section-3.3(查询前的最后一段)和这个http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
their rarely used, I think their meant to attach certain properties to paths .. maybe even control which version of segment you want to use, but this is just a hunch ... either way thank you, for bringing it up.
他们很少使用它们,我认为它们意味着将某些属性附加到路径上......甚至可以控制你想要使用哪个版本的段,但这只是一种预感...无论如何都要感谢你,提出它。
#2
27
Wow... I was not aware of that, see example:
哇......我没有意识到这一点,见例子:
>>> urlparse.urlparse("http://some.page.pl/nothing.py;someparam=some;otherparam=other?query1=val1&query2=val2#frag")
ParseResult(scheme='http', netloc='some.page.pl', path='/nothing.py', params='someparam=some;otherparam=other', query='query1=val1&query2=val2', fragment='frag')
And help(urlparse.urlparse):
和帮助(urlparse.urlparse):
Help on function urlparse in module urlparse:
urlparse(url, scheme='', allow_fragments=True)
Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes.
#1
21
fascinating, this is the first time I've encounter them, found this
http://doriantaylor.com/policy/http-url-path-parameter-syntax I also found this http://tools.ietf.org/html/rfc3986#section-3.3 (last paragraph before query) and this http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
很有趣,这是我第一次遇到它们,发现这个http://doriantaylor.com/policy/http-url-path-parameter-syntax我也找到了这个http://tools.ietf.org/html/ rfc3986#section-3.3(查询前的最后一段)和这个http://www.jtmelton.com/2011/02/02/beware-the-http-path-parameter/
their rarely used, I think their meant to attach certain properties to paths .. maybe even control which version of segment you want to use, but this is just a hunch ... either way thank you, for bringing it up.
他们很少使用它们,我认为它们意味着将某些属性附加到路径上......甚至可以控制你想要使用哪个版本的段,但这只是一种预感...无论如何都要感谢你,提出它。
#2
27
Wow... I was not aware of that, see example:
哇......我没有意识到这一点,见例子:
>>> urlparse.urlparse("http://some.page.pl/nothing.py;someparam=some;otherparam=other?query1=val1&query2=val2#frag")
ParseResult(scheme='http', netloc='some.page.pl', path='/nothing.py', params='someparam=some;otherparam=other', query='query1=val1&query2=val2', fragment='frag')
And help(urlparse.urlparse):
和帮助(urlparse.urlparse):
Help on function urlparse in module urlparse:
urlparse(url, scheme='', allow_fragments=True)
Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes.