Use the type() built-in function:

>>> i = 123
>>> type(i)
<type 'int'>
>>> type(i) is int
True
>>> i = 123.456
>>> type(i)
<type 'float'>
>>> type(i) is float
True

To check if a variable is of a given type, use isinstance:

>>> i = 123
>>> isinstance(i, int)
True
>>> isinstance(i, (float, str, set, dict))
False

Note that Python doesn't have the same types as C/C++, which appears to be your question.

Answer from gregjor on Stack Overflow
🌐
W3Schools
w3schools.com › Python › python_datatypes.asp
Python Data Types
You can get the data type of any object by using the type() function: ... Coding fundamentals as bite-sized lessons and challenges. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
Learn Python
learnpython.org › en › Variables_and_Types
Variables and Types - Learn Python - Free Interactive Python Tutorial
Python is completely object oriented, and not "statically typed". You do not need to declare variables before using them, or declare their type.
🌐
Python
docs.python.org › 3 › builtins › stdtypes.html
Built-in Types — Python 3.14.8 documentation
August 13, 2026 - The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some colle...
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-data-types
Python Data Types - GeeksforGeeks
Data types in Python define the type of value stored in a variable and determine the operations that can be performed on that data.
Published: 3 weeks ago
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-variables
Python Variables - GeeksforGeeks
Unlike Java and many other languages, Python variables do not require explicit declaration of type.
Published: 2 weeks ago
🌐
Data Science Discovery
discovery.cs.illinois.edu › guides › Python-Fundamentals › Python-data-types
Python Data Types - Data Science Discovery
Python is a dynamically typed language, meaning you don't need to declare the type of a variable explicitly.
Find elsewhere
🌐
Real Python
realpython.com › python-data-types
Basic Data Types in Python: A Quick Exploration – Real Python
4 days ago - Python’s basic data types include int, float, complex, str, bytes, bytearray, and bool. You can check a variable’s type using the type() function in Python.
🌐
Python
docs.python.org › 3 › library › datatypes.html
Data Types — Python 3.14.8 documentation
The modules described in this chapter provide a variety of specialized data types such as dates and times, fixed-type arrays, heap queues, double-ended queues, and enumerations. Python also provides some built-in data types, in particular, dict, ...
🌐
Salford PsyTech
hub.salford.ac.uk › home › learn programming › python › variables & data types – python
Variables & Data Types - Python - Salford PsyTech
June 28, 2022 - You can have different variables that hold different types of information. We are going to cover 4 basic data types which are: Integer, Float, String & Boolean. Data types Data Type Description Integer (int) Any whole number.
🌐
Medium
medium.com › @akashsdas_dev › data-types-in-python-9ae4dbc78270
Data Types in Python. In Python, variables don’t have types… | by AkashSDas | Medium
January 26, 2025 - In Python, variables don’t have types but their value does, and understanding them helps us to write better programs. Learn the basics of…
🌐
Graduate School USA
graduateschool.edu › variables, data types, and string manipulation in python
Variables, Data Types, and String Manipulation in Python | Video
March 1, 2025 - Quickly grasp core concepts like ... variables store different data types, including integers (whole numbers), floats (decimals), strings (text), and booleans (true or false)....
🌐
freeCodeCamp
freecodecamp.org › news › python-print-type-of-variable-how-to-get-var-type
Python Print Type of Variable – How to Get Var Type
February 16, 2022 - To get the type of a variable in Python, you can use the built-in type() function.
🌐
Edureka
edureka.co › blog › variables-and-data-types-in-python
Python Data Types and Variables for Beginners | Edureka
April 29, 2024 - Although there is one more data type range which is often used while working with loops in python. Numerical data type holds numerical value. In numerical data there are 4 sub types as well. Following are the sub-types of numerical data type: ... Integers are used to represent whole number values. x = 100 y = 124 # it will be the integer as long as the value is a whole number. To check the type of any variable data type, we can use the type() function.
🌐
Medium
naeemabdullah799.medium.com › python-data-types-and-variables-69d9a947faee
Python Data Types and Variables. Python Data Types and Variables | by Naeem Abdullah | Medium
July 18, 2024 - Type checking is the process of verifying the data type of a given value or variable. ... Variables are containers for storing data values. In Python, variables do not need to be declared with a specific type and can change type after being set.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-data-types-in-python
How to Use Data Types in Python – Explained with Code Examples
February 9, 2024 - A solid understanding of data types in Python is crucial as it allows programmers to write concise code. Python has several built-in data types like the sequence, numeric, mapping, set, none, and Boolean types of data.
🌐
Tutorialspoint
tutorialspoint.com › python › python_data_types.htm
Python - Data Types
Python data types are actually classes, and the defined variables are their instances or objects. Since Python is dynamically typed, the data type of a variable is determined at runtime based on the assigned value.
🌐
Medium
medium.com › @romulo.gatto › understanding-python-variables-and-data-types-eb913e61f207
Understanding Python Variables and Data Types | by Romulo Gatto | Medium
January 22, 2024 - To create a variable in Python, you simply choose a name and assign it a value using the assignment operator (=). For example: ... In the above example, age is assigned an integer value of 25 while name is assigned a string value of "John Doe". The type of the variable is implicitly determined by its assigned value.
🌐
Python documentation
docs.python.org › 3 › library › typing.html
typing — Support for type hints
1 week ago - A variable annotated with C may accept a value of type C. In contrast, a variable annotated with type[C] (or deprecated typing.Type[C]) may accept values that are classes themselves – specifically, it will accept the class object of C.
🌐
IONOS
ionos.com › digital guide › websites › web development › python data types
What Python data types are there? - IONOS
July 15, 2024 - As of Python 3, long and int are merged. Float (float): The float type includes numbers with decimal places. Complex (complex): The complex type includes complex numbers with a real part and an imaginary part, indicated by the suffix j. # Variable with integer value.