Home > Backend Development > Python Tutorial > What data types are there in python

What data types are there in python

silencement
Release: 2019-06-17 13:19:26
Original
33273 people have browsed it

In a Python program, each data is an object, and each object has its own type. Different types have different operation methods. Using the unique operation methods of built-in data types, you can complete a lot of work faster.

What data types are there in python

Some basic data types in python, such as: integer (number), string, tuple, list, dictionary and Boolean type. As the learning progress deepens, everyone will come into contact with more and more interesting data types. Beginners of Python can just understand these types first when getting started.

Corresponding symbols of python's basic built-in data types

1. Integer type - int - number

Python has 5 number types, the most common is the integer type, and the int python method is very practical. For example: 1234, -1234

2. Boolean type - bool - represented by the symbol ==

The Boolean type is a special python number type, it only has two types: True and False A value, which is mainly used for comparison and judgment, and the result is called a Boolean value.

For example:

3==3 给出True,3==5给出False
Copy after login

3) String - str - represented by ' ' or " "

For example:

'www.iplaypy.com'或者"hello"
Copy after login

4) List - —list——Use [ ] symbol to represent

, for example:

[1,2,3,4]
Copy after login

5) Tuple——tuple——Use ( ) symbol to represent

, for example:

('d',300)
Copy after login

6) Dictionary - dict - represented by { } symbol

For example:

{'name':'coco','country':'china'}
Copy after login

Which of the basic data types in Python are mutable and which are immutable

Python variable data types: list list[ ], dictionary dict{ }

Python immutable data types: integer int, string str' ', tuple tuple()

The above is the detailed content of What data types are there 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