Python tip, list contents of directory

Posted by on Aug 3, 2011 in how to, python | No Comments

Python: list contents of a directory, remove an extension from the file names.

import os
for fname in dirList:
    print fname.replace('.ext','')

Email this to someoneTweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on RedditDigg this

Leave a Reply