Quantcast
Channel: A different way to check the type of a list - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Thierry Lathuille for A different way to check the type of a list

Your code justly returns False, as you replaced the original meaning of list by your list. You shouldn't use the names of Python builtins as variable names.So, change the name of your list and it will...

View Article



Answer by Guy for A different way to check the type of a list

This is because you are shadowing the built-in listl = [1,2,3]print(type(l) == list) # Truetype(list) gives <class 'list'>, which is not [1,2,3].You can use one of the options suggested by...

View Article

A different way to check the type of a list

list = [1,2,3]print(type(list) == list) # Prints FalseOther than changing the name of the list, is there another way to check the type of this list? (Because I have already referenced the list variable...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images