标签: django
在django的/urls.py文件中,如何为字母和空格字符串编写正则表达式?
例如,url(r'^(?P<poll_id>\d+)/results/$', views.results, name='results')匹配/polls/5/results/
url(r'^(?P<poll_id>\d+)/results/$', views.results, name='results')
/polls/5/results/
我正在寻找匹配/polls/Zero%20Dark%20Thirty/results/或/polls/Inception/results/
/polls/Zero%20Dark%20Thirty/results/
/polls/Inception/results/
答案 0 :(得分:3)
使用字符类,例如'[a-zA-Z ]'
'[a-zA-Z ]'