回答編集履歴

1

追記

2019/10/30 05:43

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -61,3 +61,43 @@
61
61
  'text': {'type': 'String', 'value': 'string'}}}
62
62
 
63
63
  ```
64
+
65
+
66
+
67
+ 追記:質問編集を受けて
68
+
69
+ ---
70
+
71
+ > isdigit()で落ちる
72
+
73
+
74
+
75
+ isdigitは、**文字列が**数字のみで構成されているか判定するメソッドです。
76
+
77
+ オブジェクトが数値型であるか判定する目的には使えません。
78
+
79
+
80
+
81
+ ```Python
82
+
83
+ >>> '123'.isdigit()
84
+
85
+ True
86
+
87
+ >>> 123 .isdigit()
88
+
89
+ Traceback (most recent call last):
90
+
91
+ File "<stdin>", line 1, in <module>
92
+
93
+ AttributeError: 'int' object has no attribute 'isdigit'
94
+
95
+ ```
96
+
97
+
98
+
99
+ **蛇足**
100
+
101
+ 123 .isdigit() と間にスペースを置いているのは、
102
+
103
+ 123.isdigit() だと小数リテラルと混同された結果シンタックスエラーを吐くからです。