import json
jsonString = ‘{“Date”:“09-07-2020”,
“Time”:“3.30pm”,
“Location”:“Almora”}’
jsonObject = json.loads(jsonString)
jsonObject[“Date”]
jsonObject[“Time”]
jsonObject{“Location”]
hey what is wrong with this code
import json
jsonString = ‘{“Date”:“09-07-2020”,
“Time”:“3.30pm”,
“Location”:“Almora”}’
jsonObject = json.loads(jsonString)
jsonObject[“Date”]
jsonObject[“Time”]
jsonObject{“Location”]
hey what is wrong with this code
You actually put a curly bracket instead of square brackets.
An EOL ( End of Line ) error indicates that the Python interpreter expected a particular character or set of characters to have occurred in a specific line of code, but that those characters were not found before the end of the line . This results in Python stopping the program execution and throwing a syntax error .
The SyntaxError: EOL while scanning string literal error in python occurs when while scanning a string of a program the python hit the end of the line due to the following reasons:
when there is a missing quotation mark at the end of the sentence.
If the ending quotation mark is incorrect.
Adding multiple lines to a string constant example-"my name is…
and I’m a postgraduate "
instead of this use \n or "’ ‘’'.
The backslash before the end quotation mark