Re: python noob, multiple file i/o

2007-03-16 Thread hiro
Thanks a lot for the help guys, I'm at work right now and I will go over your suggestions one by one this weekend. Being more alert now, taking a look at the examples you posted, I now see how to approach this problem. The thing with python that I'm starting to realize is that there are a million

Re: python noob, multiple file i/o

2007-03-16 Thread hiro
Thanks a lot for the help guys, I'm at work right now and I will go over your suggestions one by one this weekend. Being more alert now, taking a look at the examples you posted, I now see how to approach this problem. The thing with python that I'm starting to realize is that there are a million

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
On Mar 16, 9:38 am, "7stud" <[EMAIL PROTECTED]> wrote: > - > import os > > filepath = "./change_files" > > li = os.listdir(filepath) > for name in li: > fullpath = filepath + "/" + name > if os.path.isfile(fullpath): > infile = open(fullpath, 'r') > >

Re: python noob, multiple file i/o

2007-03-16 Thread 7stud
The general idiom for altering lines in a file is to open the original file and write the alterations to a temp file. After you are done writing to the temp file, delete the original file, and change the temp file name to the original file name. If instead you were to read the whole file into a va

Re: python noob, multiple file i/o

2007-03-16 Thread Jordan
On Mar 16, 7:09 am, Laurent Rahuel <[EMAIL PROTECTED]> wrote: > Maybe the walk method in os module is what you > needhttp://docs.python.org/lib/os-file-dir.html > > Regards > > Jon Clements wrote: > > On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote: > >> On 16 Mar, 03:56, "hiro" <[EMAIL

Re: python noob, multiple file i/o

2007-03-16 Thread Laurent Rahuel
Maybe the walk method in os module is what you need http://docs.python.org/lib/os-file-dir.html Regards Jon Clements wrote: > On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote: >> On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> > Hi there, >> >> > I'm very new to p

Re: python noob, multiple file i/o

2007-03-16 Thread Jon Clements
On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote: > On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote: > > > > > > > Hi there, > > > I'm very new to python, the problem I need to solve is whats the "best/ > > simplest/cleanest" way to read in multiple files (ascii), do stuff to > > them,

Re: python noob, multiple file i/o

2007-03-16 Thread Jon Clements
On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm very new to python, the problem I need to solve is whats the "best/ > simplest/cleanest" way to read in multiple files (ascii), do stuff to > them, and write them out(ascii). > > -- > import os > > filePath = ('O:/spam/eggs/')

python noob, multiple file i/o

2007-03-15 Thread hiro
Hi there, I'm very new to python, the problem I need to solve is whats the "best/ simplest/cleanest" way to read in multiple files (ascii), do stuff to them, and write them out(ascii). -- import os filePath = ('O:/spam/eggs/') for file in os.listdir(filePath): #straight from docs # iterate