Django – Check URL have a trailing slash in python

QuestionsCategory: PythonDjango – Check URL have a trailing slash in python
devchandan Staff asked 4 months ago

Django – Check URL have a trailing slash in python
example.com/media/folder_name
or
example.com/media/folder_name/ 

1 Answers
Best Answer
matrix Staff answered 4 months ago

Hope this will work for you.

if URL[len(URL) -1] !="/":
     URL = URL + "/"