Review Note
Last Update: 06/01/2024 06:58 AM
Current Deck: python
Published
Fields:
Front
Python基本数据类型有哪些?
Back
Python有五种基本数据类型:数字(包括整数、浮点数和复数)、字符串、列表、元组和字典。
Code
# 整型示例
num = 10
print(type(num)) # <class &;int&;>
# 浮点型示例
num = 10.5
print(type(num)) # <class &;float&;>
# 复数示例
num = 1 + 2j
print(type(num)) # <class &;complex&;>
# 字符串示例
str = "Hello, World!"
print(type(str)) # <class &;str&;>
# 列表示例
list = [1, "a", 2.5]
print(type(list)) # <class &;list&;>
# 元组示例
tuple = (1, "a", 2.5)
print(type(tuple)) # <class &;tuple&;>
# 字典示例
dict = {"name": "John", "age": 30}
print(type(dict)) # <class &;dict&;>
Tags:
Suggested Changes:
Deck Changes (Suggestion to move the Note to the following Deck):
Field Changes:
Tag Changes: