Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
–
–
You are using
loads
when you need
load
.
json.load
is for file-like objects, and
json.loads
is for strings. (You could also load the string into memory and then parse it with
json.load
, but you don't want to do that).
Also, please don't post screenshots! They're harder to make sense of, and require clicking.
I would like to add that you are not reading the file in the code, which leads to the following (example):
with open('test.txt', 'r') as file:
print(file)
Output:
<_io.TextIOWrapper name='test.txt' mode='r' encoding='UTF-8'>
Use read():
with open('test.txt', 'r') as file:
print(file.read())
Output:
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.