About 53 results
Open links in new tab
  1. Convert integer to string in Python - Stack Overflow

    Jun 23, 2019 · In the above program, int () is used to convert the string representation of an integer. Note: A variable in the format of string can be converted into an integer only if the variable is …

  2. python - How do I parse a string to a float or int? - Stack Overflow

    Dec 19, 2008 · For the reverse, see Convert integer to string in Python and Converting a float to a string without rounding it. Please instead use How can I read inputs as numbers? to close duplicate …

  3. python - How can I check if a string represents an int, without using ...

    The built-in int () function silently truncates the fractional part of a floating point number and returns the integer part before the decimal, unless the floating point number is first converted to a string. The …

  4. python - How do I pad a string with zeros? - Stack Overflow

    How do I pad a numeric string with zeroes to the left, so that the string has a specific length?

  5. How can I convert a string to an int in Python? - Stack Overflow

    def convertStr(s): """Convert string to either int or float.""" try: ret = int(s) except ValueError: #Try float. ret = float(s) return ret That way if the int conversion doesn't work, you'll get a float returned. Edit: …

  6. 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?

  7. How to get integer values from a string in Python?

    Suppose I had a string string1 = "498results should get" Now I need to get only integer values from the string like 498. Here I don't want to use list slicing because the integer values may incr...

  8. ¿Como convertir un dato int a string en python?

    ¿Como convertir un dato int a string en python? Formulada hace 5 años y 8 meses Modificada hace 4 años y 3 meses Vista 62k veces

  9. Converting String to Int using try/except in Python

    Nov 10, 2011 · So I'm pretty stumped on how to convert a string into an int using the try/except function. Does anyone know a simple function on how to do this? I feel like I'm still a little hazy on string and i...

  10. python - Como converter uma variável string para int? - Stack Overflow ...

    Sep 18, 2015 · Como converter uma variável string para int? Perguntada 10 anos, 5 meses atrás Modified 4 anos, 3 meses atrás Vista 87mil vezes