Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the commonly used data types in Python

Shulou Source: shulou.com Published: 2022-06-02 13:17:27 09月25日 Update

This article focuses on "what are the commonly used data types in Python". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what data types are commonly used in Python.

Variables do not need to be declared

The variable of Python does not need to be declared, you can type it directly:

> a = 10

Then you have a variable an in your memory, which has a value of 10 and a type of integer. You don't need to make any special declaration before that, and the data type is automatically determined by Python.

> > print (a)

Print (type (a))

Then the output will be as follows:

ten

Here, we learned about a built-in function, type (), to query the type of variable.

Reclaim variable name

If you want a to store different data, you can assign values directly without deleting the original variables.

> a = 1.3

> print (a ~ ())

The output will be as follows

1.3

We see another use of print, where print is followed by multiple outputs, separated by commas.

Basic data type

Av10 # int integers

Av1.3 # float floating point number

A=True # True value (True/False)

A string of characters Hellograms'#. Strings can also be in double quotes.

At this point, I believe you have a deeper understanding of "what data types are commonly used in Python". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Types data variables commonly used output content characters strings integers learning queries different practical deeper that is interests memory functions followed multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Docker Shulou Tech Info vpn Shulou Technology