Přihlásit
-
Zaregistrovat
- Anonym
Ontola
≫
other
Ask Question
Python - test if variable is a string
DavidX
02/07/2013 03:59 PM (Edited 02/07/2013 03:59 PM) |
Report
In Python 2.x - string can be str or unicode, so the test is:
isinstance(s, basestring)
In Python 3.x - there are only unicode strings (str):
isinstance(s, str)
Answers
Add a answer ▾
Anonym
today 10:30 PM
Answer to the question
Sources
Insert:
Picture
Discussion
Add a question comment ▾
Anonym
today 10:30 PM