やりたいこと
jsonファイルを新規作成し、以下の内容を保存したいです。
python
1import json 2import codecs 3 4categories =[ 5 {'aaa':'あああ', 6 'bbb':'いいい', 7 'ccc':'ううう''}, 8 {'aaa':'あああ', 9 'bbb':'いいい', 10 'ccc':'ううう''}, 11 {'aaa':'あああ', 12 'bbb':'いいい', 13 'ccc':'ううう''} 14 ] 15 16 17json_file = open('category.json', 'w',) 18json.dumps(categories,json_file,ensure_ascii=False,)
出たエラー
53 json_file = open('category.json', 'w',) ---> 54 json.dumps(categories,json_file,ensure_ascii=False,) TypeError: dumps() takes 1 positional argument but 2 positional arguments (and 1 keyword-only argument) were given
回答1件
あなたの回答
tips
プレビュー
2022/03/31 12:47