Python 中的数据类型是编程的基础,常见的包括:

  • 整数 int
    用于存储整数值,如 10, -5

    integers
    [了解更多](/community/python/integer_operations)
  • 浮点数 float
    表示小数,如 3.14, 2.5e-3

    floats
    [扩展阅读](/community/python/numerical_types)
  • 字符串 str
    文本数据类型,用单引号或双引号定义

    strings
    [字符串操作指南](/community/python/string_manipulation)
  • 列表 list
    有序可变集合,用方括号包裹

    lists
    [列表进阶用法](/community/python/list_features)
  • 元组 tuple
    有序不可变集合,用圆括号包裹

    tuples
    [元组与列表对比](/community/python/tuple_vs_list)
  • 字典 dict
    键值对集合,用花括号定义

    dictionaries
    [字典操作教程](/community/python/dictionary_operations)

📌 提示:掌握数据类型能显著提升代码效率,建议结合Python 官方文档深入学习。