擅长:python、mysql、java
<p>这似乎有效:</p>
<pre><code>fields = 'lat', 'lng'
with open('test3.csv', 'wb') as csvfile:
w = csv.writer(csvfile)
w.writerow(fields) # optional header row
w.writerows(operator.itemgetter(*fields)(result['geometry']['location'])
for result in d['results'])
</code></pre>
<p>生成的<code>test3.csv</code>文件的内容:</p>
^{pr2}$