[Tutor] green brackets?
Luke Paireepinart
rabidpoobear at gmail.com
Wed Jul 11 22:55:42 CEST 2007
elis aeris wrote:
> def mousemove(x,y):
> f.write("n\")
n\ and \n are different.
n\ means "an n character and then an escaped character"
because the n\ was followed by a ", then the string literally contains n\"
for example,
"my momma always said \"life is like a box of chocolates. you never know
what you gonna get.\""
will be the following string:
my momma always said "life is like a box of chocolates. you never know
what you gonna get."
The reason they're "green" in IDLE is because there is no end " for the
string, since the \" is interpreted as "put the quotation mark into the
string instead
of stopping the string here"
> f.write("command" + " =" + " mousemove\n")
> f.write("parameter_1 = " + str(x) + "\n")
> f.write("parameter_2 = " + str(y) + "\n")
> f.write("n\")
>
> for some reason that last bracket of the 2nd and last line line in
> IDLE are green.\
> why is that?
-Luke
More information about the Tutor
mailing list