Nov-20-2018, 02:07 AM
I'm having a hard time understanding the difference between raw_input and input. Can someone dumb it down for me?
Thank you,
Emily Senechal
Thank you,
Emily Senechal
raw_input vs input
|
Nov-20-2018, 02:07 AM
I'm having a hard time understanding the difference between raw_input and input. Can someone dumb it down for me?
Thank you, Emily Senechal
Nov-20-2018, 02:13 AM
Basically,
raw_input = eval(input) . The detail is that raw_input returns a string. However input tries to evaluate that string as a Python expression before returning the result.That's how it works in Python 2.7 and earlier. In Python 3.0 and later, raw_input does not exist, and input works like raw_input in 2.7 (it just returns a string without trying to evaluate it. If at all possible you should use Python 3.0 or later (current 3.7 I believe). End of life for Python 2.7 is in a little over a year.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
Going thru tutorials..."NameError: name 'raw_input' is not defined" | hmonnier | 4 | 5,480 |
Jul-14-2020, 02:19 PM Last Post: BitPythoner |
|
raw_input | rtbr17 | 3 | 4,455 |
Sep-26-2018, 09:36 PM Last Post: nilamo |
|
URL via raw_input, passed to HTTP requests and output? | johnnyaustin | 1 | 5,484 |
Dec-08-2017, 11:22 PM Last Post: johnnyaustin |
|
Help with raw_input | Marshall_99 | 2 | 4,057 |
Mar-21-2017, 01:44 AM Last Post: Marshall_99 |
|
Cmd Module + raw_input tab [complete | ruggierom | 1 | 4,058 |
Feb-06-2017, 12:43 AM Last Post: ruggierom |
|
Any way to get raw_input to work in my function? | Pythonerous | 4 | 6,261 |
Oct-27-2016, 05:03 PM Last Post: Pythonerous |