Friday, October 02, 2009


Stupid python tricks - list of paths from a file

Take a long, repetitive list of Windows filenames, like C:\TEMP\blah.txt, and return the unique pathnames from this list:

import re


f = open('filelist.txt','r')
for line in f:"(.:\\\S+)",line)
    if m != None:'\\')

for path in pathlist:
    print path

Comments: Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?