擅长:python、mysql、java
<p>假设您自己构造url,可以使用<a href="http://docs.python.org/library/urllib.html#urllib.quote_plus" rel="nofollow">^{<cd1>}</a>对内联正斜杠进行编码:</p>
<pre><code>>>> '/'.join([urllib.quote_plus(d) for d in ['da/ta1', 'data2']])
'da%2Fta1/data2'
</code></pre>
<p>解码:</p>
^{pr2}$
<p>为了匹配数据,可以将模式更改为下面的构造。对于第一个参数,这将匹配<code>=</code>字符的所有内容;第二个参数应该是字母数字。在</p>
<pre><code>(r'^view/(?P<item_id>[^=]+)=/(?P<changekey>\w+)/$', 'view')
</code></pre>