Re: How to read all files in a directory

2005-11-07 Thread Hung Vo
Hello Larry,   Thanks a lot for your response. It helps me a lot.   I used your suggestion and got an error:     path=r'C:\datafiles\'    ^SyntaxError: EOL while scanning single-quoted string Then, I changed just a little bit and it works fine. I set path='C:\\datafile

Re: How to read all files in a directory

2005-11-03 Thread Larry Bates
Not tested: import glob import os path=r'C:\datafiles\' for fileName in glob.glob(os.path.join(path,'*.DAT')): dataFile=open(fileName, 'r').readlines() . . Continue yur code here . -Larry Bates hungbichvo wrote: > Dear All, > > My python application is small. It reads data from

Re: How to read all files in a directory

2005-11-03 Thread Stefan Arentz
"hungbichvo" <[EMAIL PROTECTED]> writes: > Dear All, > > My python application is small. It reads data from a file. > My code is: >fileName = '900128.DAT' >dataFile = open(fileName, 'r').readlines() > I have to run 100 input files .DAT. Each time I run application, I have > to change cod

How to read all files in a directory

2005-11-03 Thread hungbichvo
Dear All, My python application is small. It reads data from a file. My code is: fileName = '900128.DAT' dataFile = open(fileName, 'r').readlines() I have to run 100 input files .DAT. Each time I run application, I have to change code fileName to a new one. For example, fileName = 'NewFile