1
Hello, I’m trying to read certain data from a JSON file in Python, but I’m having some problems...
This is the JSON file:
{
"linguagem":"Python",
"dados":"JSON"
}
Implementing the JSON file directly into the Python script, it worked, and the Python program looked like this:
import json
test = '{"linguagem": "Python", "dados": "JSON"}'
arquivo = json.loads(test)
print(arquivo [linguagem])
However, I would like to access the JSON file externally. I tried the following command, which did not work:
import json
arquivo = json.loads(TesteJSON.json)
print(arquivo [linguagem])
In the latter case, "Testejson.json" is the name of the JSON file I tried to access.
If anyone can help me, I’d appreciate it!
I didn’t know that about
.load
+1– Wallace Maxters
@Wallacemaxters It’s there in the xD documentation
– Woss