About 1,190,000 results
Open links in new tab
  1. python - How to check if type of a variable is string? - Stack …

    Jan 30, 2011 · Is there a way to check if the type of a variable in python is a string, like: isinstance(x,int); for integer values?

  2. python - How to check if a variable is equal to one string or …

    Oct 8, 2012 · 'is' is used to check if the two references are referred to a same object. It compare the memory address. Apparently, 'stringone' and 'var' are different objects, they just contains …

  3. How to check if the string is empty in Python? - Stack Overflow

    Does Python have something like an empty string variable where you can do: if myString == string.empty: Regardless, what's the most elegant way to check for empty string values? I find …

  4. How to find out if a Python object is a string? - Stack Overflow

    Aug 20, 2009 · 199 Python 2 To check if an object o is a string type of a subclass of a string type:

  5. python - How to check if a variable is an integer or a string?

    Now that info has to be strictly an integer or a string, depending on the situation. However, whatever you type into Python using raw_input () actually is a string, no matter what, so more …

  6. python - How to determine if a variable is a datetime object?

    I have a variable and I need to know if it is a datetime object. So far I have been using the following hack in the function to detect datetime object: if 'datetime.datetime' in str (type …

  7. How can I tell if a python variable is a string or a list?

    Apr 12, 2017 · The other comments hilariously also do not work. Import six and check if it's a string using that for python2 and 3 compatibility as well as utf string support in python2

  8. python - how to tell a variable is iterable but not a string - Stack ...

    If you like to test if the variable is a iterable object and not a "string like" object (str, bytes, ...) you can use the fact that the __mod__() function exists in such "string like" objects for formatting …

  9. How to check whether a str (variable) is empty or not?

    Mar 29, 2012 · Python strings are immutable and hence have more complex handling when talking about its operations. Note that a string with spaces is actually an empty string but has a …

  10. Check if input is a list/tuple of strings or a single string

    I've a method that I want to be able to accept either a single string (a path, but not necessarily one that exists on the machine running the code) or a list/tuple of strings. Given that strings a...