基本数据类型概述

基本数据类型概述

想想上面的苹果(运输、储存、加工)或者下面的包装苹果是不是很容易处理。

[En]

Think about whether it is easy to deal with the apples above (transportation, storage, processing) or the packaged apples below.

基本数据类型概述

什么是数据类型

事实上,对数据类型的简单理解就是为了方便数据的处理(传输、存储、操作)。不同类型的数据是不同的包。

[En]

In fact, the simple understanding of data types is to facilitate the processing (transmission, storage, operation) of data. Different types of data are different packages.

编程语言通过一些复杂的计算机物理底层机制创建不同类型的数据,这些机制用于表示现实世界中的不同信息,从而使计算机能够更好地传输、存储和计算。

[En]

Programming languages create different types of data through some complex underlying mechanisms of computer physics, which are used to represent different information in the real world, so that computers can better transmit, store and calculate.

每种编程语言都预定义了一些基本数据类型来表示现实世界中的常见信息。

[En]

Each programming language pre-defines some basic data types to represent common information in the real world.

python中的基本数据类型

数值类型

请注意,这里标题的数值型不是基本数据类型,是我根据基本数据类型所代表的信息进行的分类,方便大家记忆和总结。以下序列、散列等。

[En]

Note that the numerical type of the title here is not a basic data type, it is my classification according to the information represented by the basic data type, which is convenient for everyone to remember and summarize. The following sequence, hash, and so on.

python用来表示数值的基本数据类型有:

  • int(整数) 用来表示数学概念中的整数
  • float(浮点数) 用来表示数学概念中的实数
  • complex(复数) 用来表示数学概念中的复数

序列类型

python用来表示有序信息的基本数据类型有:

  • str(字符串) 字符串是字符的序列表示,用来表示文本信息。
  • list(列表) 列表用来表示有序可变元素集合。例如表示一组有序的数字。
  • tuple(元组) 元组用来表示有序的不可变元素集合。

散列类型

python用来表示无序信息的基本数据类型有:

  • set(集合) 数学概念中的集合,无序不重复元素的集合。
  • dict(字典) 字典是无序键值对的集合,用来表示多维,关联数据。

其他类型

python中还有一些其他的基本数据类型

  • bool(布尔型) bool型数据只有两个元素, True表示真, False表示假。用来表示条件判断的结果。
  • None None表示空,什么都没有。

上面是数据类型的英文名称,括号中是数据类型的中文名称。首先是一个整体形象,然后我们会逐一讲解。

[En]

The above is the name of the data type in English and the Chinese name of the data type in parentheses. First, there is an overall image, and then we will explain them one by one.

当然在python中还有很多其他的数据类型,这些数据类型要么结构比较复杂,要么使用得不是很频繁,大家可以留到以后再去学习。

注意事项

这一章过后就真正进入python代码编写的学习了。我不会把python的语法单独拿出来讲,而是会融于基本数据类型的讲解中。放心,只要多多练习,这些语法就很容易学会。

另外,推荐在学习的过程中使用前面讲到的 jupyter lab,边敲代码,边做笔记,学习会事半功倍。

Original: https://www.cnblogs.com/superwuchaofan/p/16557214.html
Author: python心蓝
Title: 基本数据类型概述

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/498759/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球