Problem code:
def check_mail(self, mail): f = open("base.json", 'r') text = f.read() result = json.loads(text) return result
And the conclusion:
Traceback (most recent call last): File "/Users/Vadim/Documents/Python/Houme Task/reg.py", line 42, in <module> print(data.check_mail("sokle@gmail")) File "/Users/Vadim/Documents/Python/Houme Task/reg.py", line 32, in check_mail return json.loads(text) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads return _default_decoder.decode(s) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 342, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 73 (char 72)
MacOS / CPython 3.5
The data is written to the file in the following format:
{"sokle@gmail.com": ["Pavel", "nejcenwvewnvlewn"]}
...line 1 column 73 (char 72)
? If this is possible, give the exact line to whichjson.loads
is cursing - approximatenumberprint(open("invalid.json", "rb").read())
- jfsprint(open("invalid.json", "rb").read())