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