Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python URL.py中存在无效语法错误_Python - Fatal编程技术网

Python URL.py中存在无效语法错误

Python URL.py中存在无效语法错误,python,Python,获取URL.py中的错误。获取URL.py中的错误。获取URL.py中的错误行的末尾有一个逗号。移除它 urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', TemplateView.as_view(template_name='home.html')), url(r'^resturants/$', resturant_ListView.as_view(), url(r'^resturants/p

获取URL.py中的错误。获取URL.py中的错误。获取URL.py中的错误

行的末尾有一个逗号。移除它

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TemplateView.as_view(template_name='home.html')),
    url(r'^resturants/$', resturant_ListView.as_view(),
    url(r'^resturants/punjabi/$', punjabiresturant_ListView.as_view(),
    url(r'^resturants/thai/$', thairesturant_ListView.as_view(),
    url(r'^about/$', TemplateView.as_view(template_name='about.html')),

url(r'^contact/$',TemplateView.as_view(template_name='contact.html')),#ERROR
    ]

您至少缺少三个右括号。如果您的编辑器在选择括号时没有突出显示匹配的括号,请使用更好的编辑器。Python列表中的尾随逗号不是任何问题。
url(r'^contact/$',TemplateView.as_view(template_name='contact.html')),#ERROR