Python: checking the type of an object


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. >>> s = "A Simple String"
  2. >>> print isinstance(s, basestring)
  3. True
  4. >>> print isinstance(s, dict)
  5. False
  6. >>>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.