回答編集履歴
3
書き込み時のエンコーディングを指定
answer
CHANGED
@@ -12,6 +12,6 @@
|
|
12
12
|
|
13
13
|
config['DEFAULT']['line1'] = str(1) # 値は文字列として設定
|
14
14
|
|
15
|
-
with open("settings.ini", "w") as configfile:
|
15
|
+
with open("settings.ini", "w", encoding="utf-8") as configfile:
|
16
|
-
config.write(configfile, True
|
16
|
+
config.write(configfile, True)
|
17
17
|
```
|
2
補足を追加
answer
CHANGED
@@ -13,5 +13,5 @@
|
|
13
13
|
config['DEFAULT']['line1'] = str(1) # 値は文字列として設定
|
14
14
|
|
15
15
|
with open("settings.ini", "w") as configfile:
|
16
|
-
config.write(configfile, True)
|
16
|
+
config.write(configfile, True, encoding="utf-8")
|
17
17
|
```
|
1
Pythonのコメントは#だよね
answer
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
config = configparser.ConfigParser()
|
11
11
|
config.read("settings.ini", "utf-8")
|
12
12
|
|
13
|
-
config['DEFAULT']['line1'] = str(1)
|
13
|
+
config['DEFAULT']['line1'] = str(1) # 値は文字列として設定
|
14
14
|
|
15
15
|
with open("settings.ini", "w") as configfile:
|
16
16
|
config.write(configfile, True)
|