[請問] python的str和int?

作者: jpjpjp (jp)   2018-08-25 18:50:52
python 輸入如下
>>> a = 123
>>> a
123
>>> print(a)
123
>>> type(a)
<class 'str'>
>>> isinstance(a,str)
True
>>> isinstance(a,int)
False
>>> a.isdigit()
True
↑請問為什麼? 既然認為它不是int,
為什麼又認定它是digit?
先謝謝回覆 m(__)m
作者: robrob99 (梁龍)   2018-08-25 19:41:00
作者: wray (Rayf)   2018-08-25 22:52:00
有這函數啊,謝謝樓上!

Links booklink

Contact Us: admin [ a t ] ucptt.com