[Tutor] Reading Multiple Files in Sequence

linuxian iandsd pylinuxian at gmail.com
Fri Apr 18 23:49:03 CEST 2008


if you only want to start a loop to parse all files in a directory try
something like this:

import glob
>
> n=0
> for file in
> glob.glob('/Users/Kelvin/TEMPDATASET/CLEANEDFIELDDATA/WEST/*'):
>  n=n+1
>  new_output_file='/Users/Kelvin/TEMPDATASET/PCA/'+ str(n) + '.txt'
>  output = open(new_output_file,'w')
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080418/b3775216/attachment.htm 


More information about the Tutor mailing list