finding files that have extensions

hokiegal99 hokiegal99 at hotmail.com
Sun Dec 7 22:46:52 EST 2003


"James Kew" <james.kew at btinternet.com> wrote:

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

That's a great tip!!! This bit of code does it:

ext = os.path.splitext(fname)
if not ext[1]:
   do the rename...




More information about the Python-list mailing list