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
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
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')
>
>
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
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
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
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,
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/')
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