0

When running this

from django.urls import path
from . import views
from . import util


encyclopedia_list = util.list_entries()

urlpatterns = [
    path("", views.index, name="index")
]

for encyclopedia in encyclopedia_list:
    urlpatterns.append(path(f"{encyclopedia}", views.encyclopedia, name='encyclopedia_page')


print(urlpatterns)

script in a django app in order to test if the urlpatterns list is being updated acordingly I get a syntax error with the print function on the last line, any idea on what could be happening?

1 Answer 1

1

There's no problem with print. Close the parenthesis inside the loop

for encyclopedia in encyclopedia_list:
    urlpatterns.append(path(f"{encyclopedia}", views.encyclopedia, name='encyclopedia_page'))
Sign up to request clarification or add additional context in comments.

2 Comments

Oh... I'm so sorry for wasting your time with this, swear to god I spent about 15 mins looking at these 15 lines of code and didn't spot that, thank you so much hahaha
Haha sure. Happens a lot with me as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.