有一个url接受所有字符 [英] have a url that accepts all characters
本文介绍了有一个url接受所有字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个接受所有字符的URL,例如:
I want a url that accepts all characters,for example:
(r'^company/(?P<key>[a-zA-Z]+)/doclist/$','CompanyHub.views.docList')
对于键
参数,而不是只是ascii字母字符它接受所有字符包括数字,符号如$, - ,_,...,字母,unicode字符。
for key
parameter instead of just ascii alphabetic characters It accepts all characters include numbers,symbols like $,-,_,...,alphabet,unicode characters,...
我该怎么做?
推荐答案
应该如下所示:
(ur'^company/(?P<key>.*)/doclist/$','CompanyHub.views.docList')
我们最初需要'u'来告诉python该字符串接受unicode字符。
We need the 'u' at the beginning to tell python that the string accepts unicode characters.
这篇关于有一个url接受所有字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文