finding files that have extensions

James Kew james.kew at btinternet.com
Sun Dec 7 15:07:19 EST 2003


"hokiegal99" <hokiegal99 at hotmail.com> wrote in message
news:93f5c5e9.0312071154.4e7a1311 at posting.google.com...

> How could I define it so that *any* file that already has a
> '.xxx' extension (where x = 'abcdefghijklmnopqrstuvwxyz' upper and
> lowercase) would be excluded from the rename?

Take a look at os.path.splitext -- testing os.path.splitext(filename)[1]
will tell you if the filename carries an extension or not.

James






More information about the Python-list mailing list