Skip to content

Instantly share code, notes, and snippets.

@jdyke
Last active June 11, 2020 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdyke/453b02fc30b7925dfda30e7f4b385b8b to your computer and use it in GitHub Desktop.
Save jdyke/453b02fc30b7925dfda30e7f4b385b8b to your computer and use it in GitHub Desktop.
write_csv
def write_csv(api_keys):
headers = unique_headers(api_keys)
with open('keys.csv', 'w') as key_csv:
csv_writer = csv.writer(key_csv)
csv_writer.writerow(headers)
# Create our CSV rows using our API Key data.
for key in api_keys:
current_row = []
for field in headers:
current_row.append(key.get(field))
csv_writer.writerow(current_row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment