Advertisement
here2share

# var_type.py

Sep 11th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. # var_type.py
  2.  
  3. s = "abc"
  4. print type(s) is str
  5. s = 123
  6. print type(s) is int
  7. s = 0.5
  8. print type(s) is int # False
  9. s = 0.5
  10. print type(s) is float
  11. s = {}
  12. print type(s) is dict
  13. s = []
  14. print type(s) is list
  15. s = ()
  16. print type(s) is tuple
  17. s = None
  18. print type(s) is None # ???
  19. print type(s) == None # ???
  20. print type(s) is "<type 'NoneType'>" # ???
  21. print type(s) == "<type 'NoneType'>" # ???
  22. var = str(type(s))
  23. print var == "<type 'NoneType'>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement