How to paste python code on wordpress?

Fredrik Lundh fredrik at pythonware.com
Tue Nov 22 05:03:20 EST 2005


Dan Lowe wrote

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

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 ' (')

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>






More information about the Python-list mailing list