回答編集履歴
2
追記
test
CHANGED
@@ -25,3 +25,25 @@
|
|
25
25
|
print("False")
|
26
26
|
|
27
27
|
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
---
|
32
|
+
|
33
|
+
[公式リファレンス](https://docs.python.jp/3/tutorial/errors.html#handling-exceptions)には、次のように書いてあります。
|
34
|
+
|
35
|
+
> try 文は下記のように動作します。
|
36
|
+
|
37
|
+
> まず、 try 節 (try clause) (キーワード try と except の間の文) が実行されます。
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
さらに、節に関しては次のように書いてあります。([引用元](https://docs.python.jp/3/reference/compound_stmts.html#compound-statements))
|
42
|
+
|
43
|
+
> 一つの複合文を成す各節のヘッダは、全て同じインデントレベルに置かれます。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
try節が見つからないのが問題なのでしょう。
|
48
|
+
|
49
|
+
|
1
編集
test
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
try-exceptがelseを超えているのが問題だと思います。
|
2
|
-
|
3
|
-
が、そもそもこれelseいらなくないですかね。
|
4
2
|
|
5
3
|
```Python
|
6
4
|
|
@@ -20,10 +18,10 @@
|
|
20
18
|
|
21
19
|
break;
|
22
20
|
|
21
|
+
else:
|
23
22
|
|
23
|
+
if len(result) != 4:
|
24
24
|
|
25
|
-
if len(result) != 4:
|
26
|
-
|
27
|
-
print("False")
|
25
|
+
print("False")
|
28
26
|
|
29
27
|
```
|