Created
February 25, 2020 05:29
-
-
Save a-y-khan/d9eacb817c812fcbb201522ec12047b8 to your computer and use it in GitHub Desktop.
This file contains 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
import json | |
def parse_line(file_object): | |
while True: | |
line = file_object.readline() | |
if not line: | |
break | |
yield json.loads(line) | |
with open('test.txt', 'r') as file_reader: | |
for dict_obj in parse_line(file_reader): | |
assert isinstance(dict_obj, dict) | |
print(dict_obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment