I'm successfully returning an array that maps out the ideal path between nodes on a network.
The result is (for a sample i,j pair) something like this.
1>34>65>23>742
Now I'd like to replace the numbers with the name of the city it represents, like San Francisco (SFO), so it would read something like
SFO>LAX>DFW>JFK
I've tried using the replace functions, but to no success.
for z in range(len(names)):
nextstop = [sub.replace(z, names[z]) for sub in nextstop]
Where names contains the names of the airports, in the same order/index as the numbers.
Thanks!
where the numbers represent