擅长:python、mysql、java
<p>所以我有另一种方法来解决这个问题。代码如下:</p>
<pre><code>##remember that d is the dictionary that has the key 'results', which is also a list of dictionaries
g=d['results']
z=[d['geometry']['location'] for d in g]
keys=['lat','lng']
with open('C:/Users/J/Desktop/test4.csv', 'wb') as csvfile:
dict_writer = csv.DictWriter(csvfile, keys)
dict_writer.writer.writerow(keys)
dict_writer.writerows(z)
</code></pre>