Created
December 11, 2019 11:16
-
-
Save lekansogunle/65a740e43fd2b01deced1b2d3bc4ab83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import csv | |
saved_replies = 'saved_replies.json' | |
with open(saved_replies) as json_data: | |
d = json.load(json_data) | |
starting_point = d['saved_replies'] | |
f=csv.writer(open('saved_replies.csv','wb+')) | |
f.writerow(['Title', 'Summary', 'Details']) | |
for x in starting_point: | |
f.writerow([x['name'].encode('utf-8'), x['summary'].encode('utf-8'), "\n".join([(y.get("text") if y.get("text", False) else "\n".join(y.get("items", []))) for y in x["blocks"]]).encode('utf-8')]) | |
print "Complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment