title: Table of distances with python and google maps api
body: <p>I'm using the Google Maps API to check the distance between two points, for that, I have two files worker.csv  and job.csv.</p>
  
  <p>The goal is to know the distance of the worker for each job.</p>
  
  <p>If there are 3 workes and 2 jobs, the expected result was to be:</p>
  
  <pre><code>worker1, job1
  worker1, job2
  worker2, job1
  worker2, job2
  worker3, job1
  worker3, job2
  </code></pre>
  
  <p>But the code is returning only the first item of job:</p>
  
  <pre><code>worker1, job1
  worker1, job2
  </code></pre>
  
  <p>I believe the error is in the <strong>for</strong></p>
  
  <pre><code>import googlemaps
  import csv
  
  gmaps = googlemaps.Client(key='TOKEN')
  
  column_work = 0
  column_job = 0
  
  geo_worker = open('files/work.csv', 'r')
  geo_job = open('files/job.csv', 'r')
  out = open('files/output.csv', 'w', newline='')
  
  try:
      open_work = csv.reader(geo_worker)
      open_job = csv.reader(geo_job)
      write = csv.writer(out)
      for row in list(open_job)[1:]:
          location_job = row[column_job]
          for row in list(open_work)[1:]:
              location_work = row[column_work]
              distance = gmaps.distance_matrix(location_work, location_job)
              print(distance)
  
  finally:
      geo_worker.close()
      geo_job.close()
      out.close()
  </code></pre>
  
  <p>I would also like to get the result in table format, in the output.csv file in the following template:</p>
  
  <pre><code>worker1, distance(1,1), distance(1,2)
  worker2, distance(2,1), distance(2,2)
  worker3, distance(3,1), distance(1,2)
  </code></pre>