PDA

View Full Version : Simple Python Question...



kevin11951
March 8th, 2011, 04:03 AM
I am sure I am doing this wrong, but at the end of my script, I have this line:


input('\nPress enter to exit...')

However, when you press enter it complains that the user didn't input anything... What is the right way to do this? (In case you couldn't tell, I want to prompt the user to press enter before the script exits)

xpow
March 8th, 2011, 04:19 AM
you could try


raw_input('\nPlease enter to exit ...')

kevin11951
March 8th, 2011, 04:36 AM
you could try


raw_input('\nPlease enter to exit ...')

That worked perfectly! Wasn't "raw_input" deprecated in Python 3?

Vox754
March 8th, 2011, 07:25 AM
That worked perfectly! Wasn't "raw_input" deprecated in Python 3?

Are you perhaps running your program with Python 2?

Did you think of that? Eh?

MadCow108
March 8th, 2011, 09:36 AM
That worked perfectly! Wasn't "raw_input" deprecated in Python 3?

yes but it is a case easily handled by the 2to3 tool.
It replaces raw_input with input and input with eval(input())