In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you about what are the five standard data types in Python. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.
Learning a language often starts with HelloWorld. However, the author believes that it is not a big deal to output a "Hello World" in a black frame. To see through the nature of things and be familiar with a language, it is necessary to understand its bottom, which is the basis that we often say.
Five standard data types
There can be many types of data stored in memory.
For example, a person's name can be stored in characters, age can be stored in numbers, hobbies can be stored in sets, and so on.
There are five standard data types:
Python
Numbers
String
List
Tuple
Dictionary
The data types that belong to the collection type are lists, tuples, and dictionaries.
0x00. Figures
Numeric data types are used to store numeric values.
They are immutable data types, which means that changing the digital data type allocates a new object.
When you specify a value, the Number object is created:
12var1=1var2=2
The del statement removes references to some objects, and its syntax is:
1delvar1]
You can delete references to single or multiple objects by using the de statement. For example:
12delvar1delvar1,var2
Four different types of numbers:
Int
On a 32-bit machine, the number of digits of an integer is 32 bits, and the range of values is-2147483648, or-2147483647.
On a 64-bit system, the number of bits of an integer is 64 bits, and the range of values is-2 bits 63-1, that is,-92233720368547758089223372036854775807
Long
Unlike the C language, long integers in Python do not specify a bit width, that is, Python does not limit the size of long integer values, but in fact, long integers cannot be infinitely large because of limited machine memory.
Note that since Python2.2, if an integer is overflowed, Python automatically converts the integer data to a long integer, so not adding the letter L after the long integer data now does not cause serious consequences.
Float
Floating-point numbers are used to deal with real numbers, that is, numbers with decimals. Similar to the double type in C language, it occupies 8 bytes, of which 52 bits represent the bottom, 11 bits represent the index, and the remaining one represents the symbol.
Complex
The complex number consists of the real number part and the imaginary number part, the general form is x+yj, where x is the real part of the complex number, y is the imaginary part of the complex number, where x and y are real numbers.
These are the five standard data types in Python shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.