型態

基本classinfo有

  • 數字型態(Numeric Types):int, float, complex

  • 序列型態(Sequence Types):list, tuple, range

  • 文字序列型態(Sequence Type):str

  • 二進序列型態(Binary Sequence Types):bytes, bytearray, memoryview

  • 集合型態(Set Types):set, frozenset

  • 字典型態(Mapping Types): dict

a變數成為int數字型態

>>> a=5
>>> a
5
>>> type(a)
<class 'int'>

ss變數成為str字串型態

>>> ss='hi sean'
>>> ss
'hi sean'
>>> type(ss)
<class 'str'>

b變數成為float浮點型態

>>> b=5.0
>>> type(b)
<class 'float'>
>>> b
5.0
>>>

results matching ""

    No results matching ""