About 73 results
Open links in new tab
  1. Python 2.7 getting user input and manipulating as string without ...

    In Python 3, the raw_input function is replaced by the input function, but for compatibility reasons it is a completely different function ! In Python 3, the input function also allows to insert a …

  2. How to reverse user input in Python - Stack Overflow

    Mar 17, 2015 · Ever since Python 1.4, the slicing syntax has supported an optional third step'' orstride'' argument. For example, these are all legal Python syntax: L[1:10:2], L[:-1:1], L[::-1]. …

  3. python - How do I put a variable’s value inside a string (interpolate ...

    For ordinary functions and methods, like input, or the savefig method of Matplotlib plots, we need to prepare a string ourselves. Concatenation. Python supports using + between two strings, …

  4. Convert input to a string in Python - Stack Overflow

    Jun 28, 2016 · Past that version, if you don't give one, Python will just use the next value). Do note that in Python 2.x, you will want raw_input() rather than input() as in 2.x, the latter …

  5. How to define default value if empty user input in Python?

    Mar 19, 2019 · input = int(raw_input("Enter the inputs : ")) Here the value will be assigned to a variable input after entering the value and hitting Enter. Is there any method that if we don't …

  6. How to extract numbers from a string in Python? - Stack Overflow

    Nov 27, 2010 · I would like to extract all the numbers contained in a string. Which is better suited for the purpose, regular expressions or the isdigit() method? Example: line = "hello 12 hi …

  7. Why is `input` in Python 3 throwing NameError: name... is not …

    The result is that you're using Python 2's input, which tries to eval your input (presumably sdas), finds that it's invalid Python, and dies. Share Improve this answer

  8. python - How can I read inputs as numbers? - Stack Overflow

    Dec 8, 2013 · In Python 3.x, raw_input was renamed to input and the Python 2.x input was removed. This means that, just like raw_input , input in Python 3.x always returns a string …

  9. How do I reverse a string in Python? - Stack Overflow

    May 31, 2009 · But if you want only the characters of the string to be reversed and not the sequence of string, try this: a=input().split() #Splits the input on the basis of space (" ") for b in …

  10. python - How can I check if string input is a number? - Stack …

    The most elegant solutions would be the already proposed, a = 123 bool_a = a.isnumeric() Unfortunately, it doesn't work neither for negative integers nor for general float values of a.

Refresh