Python code, extracting extensions

Posted by user1434001 on Stack Overflow See other posts from Stack Overflow or by user1434001
Published on 2012-06-03T22:37:40Z Indexed on 2012/06/03 22:40 UTC
Read the original article Hit count: 188

Filed under:
|
|
import os

path = '/Users/Marjan/Documents/Nothing/Costco'

print path

names = os.listdir(path)

print len(names)

for name in names:
  print name

Here is the code I've been using, it lists all the names in this category in terminal. There are a few filenames in this file (Costco) that don't have .html and _files. I need to pick them out, the only issue is that it has over 2,500 filenames. Need help on a code that will search through this path and pick out all the filenames that don't end with .html or _files. Thanks guys

© Stack Overflow or respective owner

Related posts about python

Related posts about extension