Python - Structured Data Files
Find the bug in this code snippet:
import json
my_dict = {'a': 1, 'b': 2}
json_str = json.dump(my_dict)
print(json_str)Find the bug in this code snippet:
import json
my_dict = {'a': 1, 'b': 2}
json_str = json.dump(my_dict)
print(json_str)json.dump() writes JSON to a file and requires a file object as second argument.json.dump(my_dict) without file, causing error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions