Now for the flames...

Darrell Gallion darrell at dorb.com
Tue Jun 27 00:15:21 EDT 2000


Ben's is more readable. Except for the slicing of the extension, I don't
think it's too bad.
Also some people don't like letting reference counting close the files for
you. Jpython can't handle this because Java can't handle it.

import os.path

def catFiles(args, dirname, names):
    sliceLen= -len(args[1]) # Get the length of the extension we're looking
for
    for name in names:
        if args[1] == name[sliceLen:]:
            args[0].write(open(os.path.join(dirname, name)).read())

def doit(dir, outputfile):
    os.path.walk(dir, catFiles, (open(outputfile, 'w'),'.py'))

if __name__ == '__main__':
    doit('.', 'outputfile')



"David Broadwell" <dbroadwell at mindspring.com> wrote in message
news:39549529.F5FFBD89 at mindspring.com...
> Ok, now, what else am i doing that really isn't necessary?
>    (ie: point out my c hangups, please.)
>
> Ignore the exre print statements, most of those i'll comment out or
> otherwise handle. i am looking for actuall programing advice..
> specifically on if i have used any non-platform independent stuff.. (so
> that when i later migrate to haveing this same file structure that i am
> designing my toold for, they will still function.)
>






More information about the Python-list mailing list