raw_input can't handle pound sign?

Jugdish danebarney at gmail.com
Fri Dec 26 23:20:16 EST 2008


Hi, I'm having problems getting a pound sign to go through as input
sent to the raw_input() command. I'm running Python 2.5.1 on Windows
XP. Here's my simple little script:

while True:
    response = raw_input("Please enter a file name: ")
    if os.path.exists(response):
        break

Problem is if the filename has a "#" in it, the script interprets that
as the beginning of a comment (not sure why -- isn't raw_input
supposed to treat the user's input as raw text and not do any sort of
evals?)

Any ideas how to get a # to go through? Thanks!



More information about the Python-list mailing list