How can I find the datatype of a variable in Python as auto datatypes are mentioned in python?
2 Answers 2
To find the type of a variable, in python you can use the type(variable) method.
Sign up to request clarification or add additional context in comments.
Comments
yep, this:
foo = 1 print(type(foo)) results in:
<class 'int'> [Finished in 0.1s] answered Nov 23, 2020 at 6:48
Daniel Warfield
1,21211 gold badge1111 silver badges3737 bronze badges
Comments
- The Overflow Blog
-
-
- Featured on Meta
-
-
-
-
Related
Hot Network Questions
- When gold was used as a currency, was its value stable, compared to how fiat currencies “go down” in value now?
- How were large UNIX installs managed in the 80s/90s?
- How can I use sed to chain append lines from a text file, add it as a suffix to the text on the same lines numbers on another file, and so on?
- What's the point of "I shan’t try to hit two balls" joke?
- What does Tolkien mean by "eating tea" in Letters from Father Christmas?
- PS Plus subscriber — Football Manager 2024 worked yesterday on PS5 but now says "This content is not available. To use this content, purchase it"
- Domain Name Service (DNS) resolving Content Delivery Network (CDN) name
- Why does crontab use a wrong editor?
- Handling client integrity for closed/opensource mixed project
- Why does the p-value increase when I add more observations to my t-test?
- What is the USER= value reported for sudo attempts?
- Proper antonym of "body shaming"
- Are men not allowed to perform any sacrifice or ritual without a wife according to the Vedas?
- Jesus said if He didn't go away the Holy Spirit wouldn't come. He also said He [already] abides with you and will be in you. Is Jesus the Holy Spirit?
- How to change the color of the individual squares on a chessboard?
- Can I delete the Chrome's OptGuideOnDeviceModel safely? It's taking up 4GB
- Can a Gazer using Telekinetic Ray throw a creature 30 feet up in the air?
- Does an SMS OTP have to be recreated for every message?
- circuitikz: How to find the dimensions (width, height, thickness) of a component?
- circuitikz: How to rotate the "component-labels" in normal alignment (for example ϑ↑↓)
- Why couldn't all assimilees be liberated from the Borg?
- What is a realistic size and population for a predator that eats humans?
- Moore state diagram
- Can military personnel disobey illegal orders under U.S. law?
lang-py
type(variable_name)