| 12345678910111213141516171819202122232425 |
- """
- example04 - 使用type函数检查变量的类型
- auther: tanlie
- date: 2026/8/20
- """
- a = 45
- b = 3.14
- c = "123.45"
- d = True
- print(type(a)) # <class 'int'>
- print(type(b)) # <class 'float'>
- print(type(c)) # <class 'str'>
- print(type(d)) # <class 'bool'>
- print(str(a)) # 45
- print(int(b)) # 3
- print(float(c)) # 123.45
- print(int(d)) # 1
- print(int(False)) # 0
- print(ord('檀')) # 27264
- print(chr(65)) # A
|