[FRPythoneers] Question about Try/Except
jafo at tummy.com
Mon Jun 3 15:26:18 MDT 2002
On Mon, Jun 03, 2002 at 03:34:32PM -0600, J. Wayde Allen wrote:
>pages as necessary to ensure security. What I often wonder about is how
>much is enough? Taking care about how these data are used, how they are
>passed to other system programs, etc. seems to make a lot of sense, but
I will usually use the re module to ensure that only the characters I want
are in the field.
>>> import re
>>> field = 'Hello there\"; rm -rf /'
>>> newField = re.sub(r'[a-zA-Z ]', '', field)
>>> if newField: print 'The following characters are not allowed:', newField
The following characters are not allowed: ";-/
A computer is like an Old Testament god, with a lot of rules and no mercy.
-- Joseph Campbell
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python
More information about the FRPythoneers