About 50 results
Open links in new tab
  1. r"string" b"string" u"string" Python 2 / 3 comparison

    Feb 5, 2019 · I also have seen u"string" for, I think, Unicode strings. Now with Python 3 we see b"string". I have searched for these in different sources / questions, such as What does a b prefix before a …

  2. How to check if variable is string with python 2 and 3 compatibility

    @Chandler.Huang this question is about identifying str and unicode on Python 2, or str on Python 3. If you don't want unicode to count on Python 2, just use str.

  3. python - Pandas distinction between str and object types - Stack …

    Jan 19, 2016 · As a very brief explanation that isn't a full answer: If you use a string dtype in numpy, it's fundamentally a fixed-width c-like string. In pandas, they're "normal" python strings, thus the object type.

  4. String formatting in Python: can I use %s for all types?

    Jan 24, 2013 · See String Formatting Operations for more details. As an alternative, as of Python 2.6 and up you can also use a different form of string formatting using the .format() method:

  5. python - What exactly do "u" and "r" string prefixes do, and what are ...

    There are two types of string in Python 2: the traditional str type and the newer unicode type. If you type a string literal without the u in front you get the old str type which stores 8-bit characters, and with the …

  6. python - isinstance with string representing types - Stack Overflow

    Mar 24, 2023 · You don't have a type stored as a string. You have a string which mypy can interpret as int | str. eval works because it's a superset of what you want, which is to parse and evaluate a type …

  7. python - How to access a string from C code with ctypes - Stack …

    Nov 16, 2025 · For Python, this type points to a single char so we have to cast it to get the whole string after searchtest is done. We cast to c_char_p because we just want to read the value so a const …

  8. Python pandas: how to specify data types when reading an Excel file?

    Sep 15, 2015 · Starting with v0.20.0, the dtype keyword argument in read_excel() function could be used to specify the data types that needs to be applied to the columns just like it exists for read_csv() …

  9. python - How to check if type of a variable is string? - Stack Overflow

    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?

  10. How to convert list of strings to their correct Python types?

    14 Given a list of python strings, how can I automatically convert them to their correct type? Meaning, if I have: