Mega Code Archive

 
Categories / Python / Data Type
 

Whats True in Python

#      0 is false; all other numbers are true. #      An empty string ("") is false, all other strings are true. #      An empty list ([]) is false; all other lists are true. #      An empty tuple (()) is false; all other tuples are true. #      An empty dictionary ({}) is false; all other dictionaries are true.