Well, obviously you could use print(type(x)), but that's not very useful, since type doesn't return a string but a class, and then print will call str() on it, so you typically and up with the repr() of the class:
print(type(''))# <class 'str'>
What you can do is hit the introspection bits, for example:
Top comments (9)
Well, obviously you could use
print(type(x))
, but that's not very useful, sincetype
doesn't return a string but a class, and then print will callstr()
on it, so you typically and up with therepr()
of the class:What you can do is hit the introspection bits, for example:
Which is a bit prettier.
str.join() takes exactly one argument (3 given) :)
Nice catch - I edited to pass in a tuple rather than the args directly.
Thanks for the demonstration that good code review is important!
print(type(x))
print(type(x))
1
The correct answer is the answr number one
1
print(type(x))