>> Again, thanks a lot. Too bad you and Kushal don't live close. I would
>> like to invite you to a beer or a coffe or something.
>
> Thanks for the offer. Some time ever in the far, far future perhaps ;-).
Well, if you or the other people who have been so helpful to me in
this list ever happen to
Thanks Alan,
why is it better to open the output file outside the entire
>> loop.
>
> Because you only need to open it once and leave it open.
> You are opening it each and every time which is wasteful.
> It could on some OSDS also lead to problems. And if you
> were writing a new file rather tha
"Josep M. Fontana" wrote
OK, I ask you (or anybody reading this) the same question I asked
Kushal: why is it better to open the output file outside the entire
loop.
Because you only need to open it once and leave it open.
You are opening it each and every time which is wasteful.
It could on
> Again, thanks a lot. Too bad you and Kushal don't live close. I would
> like to invite you to a beer or a coffe or something.
Thanks for the offer. Some time ever in the far, far future perhaps ;-).
>
>> So close ;-).
>> What you're missing is the next write statement:
>> f.write(data)
>>
>>
Hi Evert,
Again, thanks a lot. Too bad you and Kushal don't live close. I would
like to invite you to a beer or a coffe or something.
>>
>> - code
>> import os
>> path = '/Volumes/DATA/MyPath'
>> os.chdir(path)
>> file_names = glob.glob('*.txt')
>
> You don't use file_nam
Hi Kushal,
First of all, thanks a lot for your help.
>
> Your current code adds the marker line to the original files. Is that
> intended?
Well, no, this wasn't intended. The part of the code that did that was
introduced in one of the many attempts to solve the problem. I knew
that this was an
- Original message -
> Hi,
>
> I'm trying to create a script to do the following. I have a directory
> containing hundreds of text files. I need to create a single file with
> the contents of all the files in the directory. Within that file,
> though, I need to create marks that indicate
> I'm trying to create a script to do the following. I have a directory
> containing hundreds of text files. I need to create a single file with
> the contents of all the files in the directory. Within that file,
> though, I need to create marks that indicate the division between the
> contents of
Hi,
I'm trying to create a script to do the following. I have a directory
containing hundreds of text files. I need to create a single file with
the contents of all the files in the directory. Within that file,
though, I need to create marks that indicate the division between the
contents of each