Skip to content

Instantly share code, notes, and snippets.

@kracekumar

kracekumar/read.py

Created Dec 9, 2017
Embed
What would you like to do?
read json file
def read_data(files, total_records):
records = []
while len(records) < total_records:
# Rotate the files queue
files.rotate(1)
with open(files[0]) as handle:
data = json.load(handle)
for record in data:
records.append(record)
If len(records) >= total_records:
break
return records
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.