raw_input can't handle pound sign?

Jugdish danebarney at gmail.com
Sat Dec 27 05:20:16 CET 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