Dan Lowe wrote

> Replace < with &lt;
>
> Replace > with &gt;
>
> (where those abbreviations stand for "less than" and "greater than")
>
> Before: if x < 5:
>
> After: if x &lt; 5:
>
> Another common character in code that you "should" do similarly is
> the double quote ("). For that, use &quot;
>
> Before: if x == "foo":
>
> After: if x == &quot;foo&quot;:

footnote: stricly speaking, > is a "should" as well (it only has special
meaning in an open tag).  and " is a "may" (it only has special meaning
in attributes quoted by double quotes).  the same applies to ' (&apos;)

if you're escaping by hand, you usually only need to care about & and <.

if you're using code to do the escaping, you might as well escape all give
(< > & " ').

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to