A question

Fredrik Lundh fredrik at pythonware.com
Mon Oct 18 03:22:58 EDT 1999


Will Ware <wware-nospam at world.std.com> wrote:
> Other folks have mentioned glob.glob(), which will work fine for
> things like "*.txt". If you want something more flexible, for
> instance all the *.c and *.h files that mention printf,
> you'd want to iterate on the output of something like
> 
> find . -name '*.[ch]' -exec grep -l printf {} \;

footnote:

import find

for file in find.find("*.[ch]", "."):
    print file

solves half of that problem.  string.find can be used
to handle the rest, in a portable way.

</F>

<!-- later today:
http://www.pythonware.com/people/fredrik/librarybook.htm
(the eff-bot guide to) the standard python library. -->





More information about the Python-list mailing list