[Tutor] regular expression/ reading a directory

Conrad Koziol arkamir at softhome.net
Mon Feb 9 14:02:32 EST 2004


I need to write a cross platform script which reads the directory and
spits out files which only have 1 underscore and end in html. Equivelent
to this in the bash shell:

ll | grep ^[^_]*_[^_]*.css

How would I do this? Is there anyway to specifically select only those
files from a directory, something similiar to os.listdir() or is there a
grep tool for python to match items in a list or dictionary to a regular
expression. Also how would I run a shell script or another python
program from inside another program.

Thanks a lot!!
	Conrad




More information about the Tutor mailing list