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

    We can use the raw_input() function in Python 2 and the input() function in Python 3. By default the input function takes an input in string format. For other data type you have to cast the user input. In Python …

  2. What's the difference between `raw_input()` and `input()` in Python 3?

    In Python 2, raw_input() returns a string, and input() tries to run the input as a Python expression. Since getting a string was almost always what you wanted, Python 3 does that with input().

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

    Dec 8, 2013 · Python 2.x There were two functions to get user input, called input and raw_input. The difference between them is, raw_input doesn't evaluate the data and returns as it is, in string form. …

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

    Here I have to set the default value if the user will enter the value from the keyboard. Here is the code that user can enter value: input = int(raw_input("Enter the inputs : ")) Here the value wi...

  5. python - how to add an error message when an integer is input instead ...

    Mar 17, 2022 · You could try running a while loop for the input statements. Checking if the input (in string format) is numeric and then casting it to int. Sample code:

  6. Check if a word is in a string in Python - Stack Overflow

    I'm working with Python, and I'm trying to find out if you can tell if a word is in a string. I have found some information about identifying if the word is in the string - using .find, but is ther...

  7. python if user input contains string - Stack Overflow

    python string if-statement input python-3.x edited Jul 3, 2013 at 18:50 Ashwini Chaudhary 252k 60 479 520

  8. python - Getting a hidden password input - Stack Overflow

    Aug 16, 2021 · Features: Works for passwords up to 64 characters Accepts backspace input Outputs * character (DEC: 42 ; HEX: 0x2A) instead of the input character Demerits: Works on Windows only …

  9. How to define a function to take a string as input in Python 3

    Feb 17, 2017 · 1 As long as you document this properly, the requirement that a user pass a string to the function input should not cause concern or issues. This is standard in all Python functions that accept …

  10. string - How to convert an user input to a set in python ... - Stack ...

    Aug 14, 2021 · First you need to use input instead of print. print is to print something on terminale/ command line, it is also possible to get user input with your script without (str =) like so :