filter directory
Thomas Guettler
guettli at thomas-guettler.de
Sun May 18 06:33:18 EDT 2003
On Sat, May 17, 2003 at 01:11:29PM +1000, Psybar Phreak wrote:
> ok - does anyone know how to :
>
> filter the contents of a folder depending on the extension?
This script lists all files ending with ".txt". Is this what you want?
import os
my_files=[]
for file in os.listdir("."):
if file.lower().endswith(".txt"):
my_files.append(file)
print my_files
thomas
--
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de
More information about the Python-list
mailing list