scanf style parsing
Aahz Maruch
aahz at panix.com
Sun Sep 30 17:56:26 EDT 2001
More information about the Python-list mailing list
Sun Sep 30 17:56:26 EDT 2001
- Previous message (by thread): scanf style parsing
- Next message (by thread): scanf style parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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)[1] > 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 speed. ;-) >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.
- Previous message (by thread): scanf style parsing
- Next message (by thread): scanf style parsing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list