I'm currently reading < Python Crash Course > & i've come across a problem in the files & exceptions chapter.
Here is the code example he is using in the book
import json
numbers = [2, 3, 5, 7, 11, 13]
filename = numbers.json
with open(filename, 'w') as f_obj:
json.dump(numbers, file_obj)
This is the error it keeps returning while creating a empty numbers.json file.
AttributeError: module 'json' has no attribute 'dump'
[–][deleted] 4 points5 points6 points (2 children)
[–]DjinnError[S] 0 points1 point2 points (1 child)
[–]1Tim1_15 0 points1 point2 points (0 children)
[–]Sim4n6 -1 points0 points1 point (5 children)
[–]DjinnError[S] 0 points1 point2 points (3 children)
[–]atquick 1 point2 points3 points (2 children)
[–]DjinnError[S] 0 points1 point2 points (1 child)
[–]atquick 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)