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

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Nov 27 11:12:00 CET 2013


On 27/11/2013 08:45, Peter Otten wrote:
> 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
>

Thanks Peter.

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence



More information about the Tutor mailing list