目前,我的正则表达式采用这样的问题ID(有效):
url(r'^(?P<college_id>[0-9]+)/$', views.detail, name="detail")
但是我希望它取college_name
一个没有空格的字符串。我该如何设置?
你可以用 r'^(?P<college_name>\w+)/$'
这是测试正则表达式的好工具:https : //regex101.com/r/q6fWPl/1
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句