KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm playing with both learning Python and am trying to get GitHub issues into a readable form. Using the advice on How can I convert JSON to CSV? , I came up with this: import json import csv f = open('issues.json') data = json.load(f) f.close() f = open("issues.csv", "wb+") csv_file = csv.writer(f) csv_file.writerow(["gravatar_id", "position", "number"]) for item in data: csv_file.writerow([item["gravatar_id"], item["position"], item["number"]]) Where "issues.json" is the JSON file containing my GitHub issues. When I try to run that, I get TypeError: string indices must be integers What am I missing here? Which are the "string indices"? Here's a bit of my JSON content: {"issues": [{"gravatar_id": "44230311a3dcd684b6c5f81bf2ec9f60", "position": 2.0, "number": 263...
Tags (comma-separated)
Save Edits
Cancel