[Tutor] using quotes in IDLE
Alan Gauld
alan.gauld at btinternet.com
Fri Dec 14 09:45:28 CET 2007
"Jim Morcombe" <jmorcombe at westnet.com.au> wrote
> When typing things into IDLE, how are quotes meant to work?
>
> If I type"
>
>employee.name = "Susan"
>
> then IDLE ignores the last " and I get an error.
Quotes should work the same in Idle as anywhere else!
I suspect what you are doing is trying to create a double
quote by typing two single quotes. That won't work.
The types of quotes you can use are:
'text' = single quote at each end
(using single quote key, right end of middle row on UK
keyboard)
"text" = double quote at each end
(using the double quote key, shift 2 on a UK keyboard)
'''text''' = triple single quote - three consecutrive single quote
keystrokes
"""text""" = triple double quote - three consecutive double quote
keystrokes
You cannoyt use two consecutive single quotes to create
a double quote, like
''text'' because Python sees that as an empty string followed
by a name followed by another empty string which is an error.
Did I guess right?
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list