質問するログイン新規登録

回答編集履歴

1

追記

2019/10/30 05:43

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -29,4 +29,24 @@
29
29
  ```
30
30
  {'variables': {'Id': {'type': 'Integer', 'value': '4444'},
31
31
  'text': {'type': 'String', 'value': 'string'}}}
32
- ```
32
+ ```
33
+
34
+ 追記:質問編集を受けて
35
+ ---
36
+ > isdigit()で落ちる
37
+
38
+ isdigitは、**文字列が**数字のみで構成されているか判定するメソッドです。
39
+ オブジェクトが数値型であるか判定する目的には使えません。
40
+
41
+ ```Python
42
+ >>> '123'.isdigit()
43
+ True
44
+ >>> 123 .isdigit()
45
+ Traceback (most recent call last):
46
+ File "<stdin>", line 1, in <module>
47
+ AttributeError: 'int' object has no attribute 'isdigit'
48
+ ```
49
+
50
+ **蛇足**
51
+ 123 .isdigit() と間にスペースを置いているのは、
52
+ 123.isdigit() だと小数リテラルと混同された結果シンタックスエラーを吐くからです。