You may be looking for the type()
builtin function.
See the examples below, but there’s no “unsigned” type in Python just like Java.
Positive integer:
>>> v = 10
>>> type(v)
<type 'int'>
Large positive integer:
>>> v = 100000000000000
>>> type(v)
<type 'long'>
Negative integer:
>>> v = 10
>>> type(v)
<type 'int'>
Literal sequence of characters:
>>> v = 'hi'
>>> type(v)
<type 'str'>
Floating point integer:
>>> v = 3.14159
>>> type(v)
<type 'float'>
1
 1
I had to double take when I saw this. Java SE8 now contains unsigned integers, and I’ve developed so much with it that it seems sinful that Java never had unsigned integers before SE8.
Nov 26, 2018 at 15:39
Possible duplicate of What’s the canonical way to check for type in Python?
Jun 19, 2019 at 12:32
Also: Determine the type of an object?
Jun 19, 2019 at 12:32
Specifically wrt “whether it’s unsigned 32 bit, signed 16 bit, etc” the answer is “the documentation”. Python doesn’t have 16/32 bit or signed/unsigned int, it has: (1) integers (unlimited precision: “long integer” was removed in python 3); (2) floating point numbers (typically equivalent to a double in C); and, (3) complex numbers (real + imaginary, both floats). See docs.python.org/3/library/stdtypes.html#typesnumeric
Oct 23, 2020 at 8:18
