scanf style parsing
aahz at panix.com
Sun Sep 30 23:56:26 CEST 2001
In article <Xns91297E5A71028duncanrcpcouk at 127.0.0.1>,
Duncan Booth <duncan at rcp.co.uk> wrote:
>tim at vegeta.ath.cx (Tim Hammerquist) wrote in
>news:slrn9r61oo.uim.tim at vegeta.ath.cx:
>Wouldn't you be happier with this?:
> extensions = ['.htm', '.html', '.shtm', '.shtml', '.phtm',
> '.phtml', '.cgi', '.php', '.php2', 'php3', '.php4', '.pl']
> ext = os.path.splitext(filename)
> if ext in extensions:
>which has the arguable advantage of matching what your description says
>instead of what your original code does.
Well, if you're going to do that, extensions should be a dict for real
>regexes are wonderful: in moderation.
'Some people, when confronted with a problem, think "I know, I'll use regular
expressions". Now they have two problems.' --Jamie Zawinski, comp.lang.emacs
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
We must not let the evil of a few trample the freedoms of the many.
More information about the Python-list