0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pythonでJSONファイルを書き出すときに、日本語を文字化けしないようにする

Posted at
import json
d = {"日本語":81}
fw = open('keywords_appearances.json','w', encoding='utf8')
json.dump(d,fw,indent=4,ensure_ascii=False)

open()の中のencodingをutf8にした後、json.dumpのensure_ascii=Falseに設定する

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?