[Python] to determine the variable type is a List List

Usage: isinstance (variable, List )

li = [1,2,3]
print(type(li))

if isinstance(li,list):
    print("This is a List")
<class 'list'>
This is a List

 

Guess you like

Origin www.cnblogs.com/leoshi/p/12297767.html