[Tutor] Issue w/ string input "for", "not", "while", "else" etc.

Peter Otten __peter__ at web.de
Wed Nov 27 09:45:20 CET 2013


Rafael Knuth wrote:

> simple issue I couldn't find a solution for:
> 
> YourName = input(str("What is your name?"))
> print("Hello", YourName)
> 
> When executing the program, in case the user input is "for", "not",
> "True", "while" Python interprets that as a command and changes the
> input's color to the corresponding command. The program runs without
> any further issues, but I was wondering: How can I make sure Python
> "understands" that the user input is nothing else but a string? I
> tried to fix that by changing input("What is your name?") to
> input(str("What is your name?)) but that didn't work.
> 
> Thanks in advance,

I took the freedom to report it myself:

http://bugs.python.org/issue19808




More information about the Tutor mailing list