What are the variable data types in Python?

青灯夜游
Release: 2019-06-14 18:37:52
Original
16165 people have browsed it

What are the variable data types in Python?

There are six basic data types of python3: Number (int, float, bool, complex), String, List, Tuple, Dictionary, Set

Variable Data types: list, dic, set

Immutable data types: Number, String, Tuple

What are variable data types and immutable data types?

1. The immutable data type in Python does not allow the value of the variable to change. If the value of the variable is changed, it is equivalent to creating a new object. For objects with the same value, there is only one object in the memory, and there is an internal reference count to record how many variables refer to this object.

2. The variable data type in Python allows the value of the variable to change. If the variable is appended, =, etc., it will only change the value of the variable without creating a new object. The address of the object referenced by the variable will not change either. However, for different objects with the same value, there will be different objects in the memory, that is, each object has its own address, which is equivalent to saving multiple copies of the object with the same value in the memory. There is no reference counting here. Real objects.

The above is the detailed content of What are the variable data types in Python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template