Skip to content

Instantly share code, notes, and snippets.

@kracekumar
Created December 9, 2017 18:36
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 kracekumar/20cfeec5dc99b084c879ce737f7c7214 to your computer and use it in GitHub Desktop.
Save kracekumar/20cfeec5dc99b084c879ce737f7c7214 to your computer and use it in GitHub Desktop.
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