Python - Structured Data Files
What will be the output of this code snippet?
import json
json_data = '{"city": "Paris", "population": 2148327}'
data = json.loads(json_data)
print(data['city'])What will be the output of this code snippet?
import json
json_data = '{"city": "Paris", "population": 2148327}'
data = json.loads(json_data)
print(data['city'])json.loads() converts JSON string to Python dictionary.data['city'] accesses the value 'Paris'.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions