Question

I'm writing a TSP algorithm using python and the output is a list of node route like : path [1,2,3,4,5] where each number is a key of city name. now i need to retrieve the whole list in browser but i can't because i only get one value from the list when i use return path note : my code is running perfectly since the output appear in console window. any ideas ??

simple example :

file.py
def temp():
path=[1,2,3,4,5]
return path

file.html
{{extend 'layout.html'}}
<h1>{{=path}}</h1>
Was it helpful?

Solution

You should do it as:

path=[1,2,3,4,5]
return str(path)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top