Skip to content

Instantly share code, notes, and snippets.

@balkian
Created September 27, 2016 09:19
Show Gist options
  • Save balkian/196bf8a0547b679c6ee23532bd94dabb to your computer and use it in GitHub Desktop.
Save balkian/196bf8a0547b679c6ee23532bd94dabb to your computer and use it in GitHub Desktop.
Rec
import glob
import json
def process_file(f):
print(json.load(f.read())
for f in glob.glob('semeval/*.json'):
""" Find every file in the semeval folder that matches **.json
"""
with open(f) as w:
process_file(w)
import os
def process_file(f):
print(json.load(f.read())
for root, dirs, files in os.walk('semeval'):
""" Find every file in the folder tree that matches **.json
"""
for file in files:
if file.endswith(".json"):
with open(os.path.join(root, file)) as w:
process_file(w)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment