fnmatch() function

Psybar Phreak psybar_phreak at yahoo.com
Fri May 16 20:23:02 EDT 2003


hi everyone

here's my situation - i have a sub-folder (called diaries) i have some files
and sub-folders within that folder.  the files ahve different extensions
(*.dia, *.eve).

what i want to do it go through all the files in the folder that end in
*.dia, and print the first 2 lines from them.

now ive just found the function called fnmatch() (after trying to use glob
only to realise its for PATHname and not FILEnames)

would this be the best thing to use?  can someone show me how this would be
done, cause i really can't find anything about how to actually USE the
function

thanks everyone!






More information about the Python-list mailing list