Best way to do this? List loop (matrix?) iteration
d at davea.name
Thu Jan 10 00:49:53 CET 2013
On 01/09/2013 06:24 PM, andydtaylor at gmail.com wrote:
> Thanks for your help - this is what I did - though it's probably obvious to most people reading this.
> for rowcount in range (0, stn_count):
> for colcount in range (0, stn_count):
> # 3. Determine Station pairs for API query
> query_origin_stop = stn_list_long[rowcount]
> query_destination_stop = stn_list_long[colcount]
> # 4. Paths for determining duration. "station x = station x" has journey time 0
> # 4a. Stations are SAME
Please reread Chris Angelico's message. Iterating over the lists
themselves, instead of making a range, is shorter, easier to read, and
> ....etc. and this part works! I am now stuck on something else though, but I'll start a new topic for that.
for rowshort, query_origin_stop in zip(stn_list_short, stn_list_long):
for query_destination_stop in stn_list_long:
#4 . Determine ...
More information about the Python-list