Python 中的数据类型是编程的基础,常见的包括:
整数
int
用于存储整数值,如10
,-5
[了解更多](/community/python/integer_operations)浮点数
float
表示小数,如3.14
,2.5e-3
[扩展阅读](/community/python/numerical_types)字符串
str
文本数据类型,用单引号或双引号定义 [字符串操作指南](/community/python/string_manipulation)列表
list
有序可变集合,用方括号包裹 [列表进阶用法](/community/python/list_features)元组
tuple
有序不可变集合,用圆括号包裹 [元组与列表对比](/community/python/tuple_vs_list)字典
dict
键值对集合,用花括号定义 [字典操作教程](/community/python/dictionary_operations)
📌 提示:掌握数据类型能显著提升代码效率,建议结合Python 官方文档深入学习。