質問編集履歴

3

uftをutfへ

2022/12/05 08:30

投稿

gamera_niki
gamera_niki

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,5 @@
1
1
  ### 前提
2
- f = open("text.txt", "+w", encoding="uft-8")
2
+ f = open("text.txt", "+w", encoding="utf-8")
3
3
  F = f.write()
4
4
  print(F)
5
5
  f.close()

2

誤字の修正

2022/12/05 07:01

投稿

gamera_niki
gamera_niki

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,14 +1,20 @@
1
1
  ### 前提
2
- f = open("text.txt", "+", encoding="uft-8")
2
+ f = open("text.txt", "+w", encoding="uft-8")
3
+ F = f.write()
4
+ print(F)
5
+ f.close()
6
+ このようなエラーが出てしまっています。
3
- TypeError Traceback (most recent call last)
7
+ LookupError Traceback (most recent call last)
4
8
 
5
- <ipython-input-2-e67165d45b3f> in <module>
9
+ <ipython-input-4-9d1a9a487915> in <module>
6
- ----> 1 f = open("text.txt", "+", decoding="uft-8")
10
+ ----> 1 f = open("text.txt", "+w", encoding="uft-8")
7
11
  2 F = f.write()
8
12
  3 print(F)
9
13
  4 f.close()
10
- このようなエラーが出てしまっています。
14
+
11
- TypeError: 'decoding' is an invalid keyword argument for open()
15
+ LookupError: unknown encoding: uft-8
16
+
17
+
12
18
  すでに所持しているテキストやインターネットでは1時間は探しています。
13
19
 
14
20
  ### 実現したいこと
@@ -17,21 +23,24 @@
17
23
  ・「bye」が入力されたなら一度ファイルを閉じ、再度ファイルを開き、ファイルの文字列を読みだして画面に出力する
18
24
 
19
25
  ### 発生している問題・エラーメッセージ
20
- TypeError Traceback (most recent call last)
21
26
 
27
+ LookupError Traceback (most recent call last)
28
+
22
- <ipython-input-2-e67165d45b3f> in <module>
29
+ <ipython-input-4-9d1a9a487915> in <module>
23
- ----> 1 f = open("text.txt", "+", decoding="uft-8")
30
+ ----> 1 f = open("text.txt", "+w", encoding="uft-8")
24
31
  2 F = f.write()
25
32
  3 print(F)
26
33
  4 f.close()
27
34
 
28
- TypeError: 'decoding' is an invalid keyword argument for open()
35
+ LookupError: unknown encoding: uft-8
36
+
37
+
29
38
 
30
39
 
31
40
 
32
41
  ### 該当のソースコード
33
42
 
34
- f = open("text.txt", "+", decoding="uft-8")
43
+ f = open("text.txt", "+", encoding="uft-8")
35
44
  F = f.write()
36
45
  print(F)
37
46
  f.close()

1

前提の修正

2022/12/05 06:58

投稿

gamera_niki
gamera_niki

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,5 @@
1
1
  ### 前提
2
- f = open("text.txt", "+", decoding="uft-8")
2
+ f = open("text.txt", "+", encoding="uft-8")
3
3
  TypeError Traceback (most recent call last)
4
4
 
5
5
  <ipython-input-2-e67165d45b3f> in <module>