Return True if the object is a string type. Args: s (string): A string (str, unicode, bytes). Returns: :obj:`bool`: True if the object is a type of string. Otherwise, False.
(s)
| 60 | |
| 61 | |
| 62 | def isstr(s): |
| 63 | """Return True if the object is a string type. |
| 64 | |
| 65 | Args: |
| 66 | |
| 67 | s (string): A string (str, unicode, bytes). |
| 68 | |
| 69 | Returns: |
| 70 | |
| 71 | :obj:`bool`: True if the object is a type of string. Otherwise, False. |
| 72 | |
| 73 | """ |
| 74 | try: |
| 75 | return isinstance(s, basestring) |
| 76 | except NameError: |
| 77 | return isinstance(s, str) |
| 78 | |
| 79 | |
| 80 | # Python 2 rounding behavior |
no outgoing calls
no test coverage detected