What is the difference between input() and raw_input() in Python?

97 views

What is the difference between input() and raw_input() in Python?

What is the difference between input() and raw_input() in Python?

solveurit24@gmail.com Changed status to publish February 13, 2025
0
  • input() (Python 3):
    • Reads a line from input, converts it to a string, and returns it.
  • raw_input() (Python 2):
    • Reads a line from input and returns it as a string (no conversion).
    • raw_input() was renamed to input() in Python 3, and the old input() function (which evaluated the input as a Python expression) was removed.

Note:

In Python 3, use input() to read input as a string.

solveurit24@gmail.com Changed status to publish February 13, 2025
0
You are viewing 1 out of 1 answers, click here to view all answers.