[Tutor] How to get script to detect whether a file exists?

Hugo Arts hugo.yoshi at gmail.com
Mon Aug 2 02:38:12 CEST 2010


On Mon, Aug 2, 2010 at 2:26 AM, Richard D. Moores <rdmoores at gmail.com> wrote:
>
> Well, I'd like to try. Could you give me, say, an outline of what
> might be a good way? Actually, before I changed to the error catching,
> I tried to break it up into a bunch of small functions. But they got
> all tangled up with some functions returning the calling of others,
> that I couldn't get them straightened out. Also, some were required to
> have such a long string of arguments I couldn't get them all on one
> line.
>

For starters, the code recreating both your files is almost exactly
the same, so you can easily turn that into one function and call it
twice. I see two necessary arguments, the path and the data you're
dumping in. See if you can work that one out.

The file saving code at the end is another one that can be easily made
into one function and called twice. If you get those two pieces done
you should be in good shape.

Hugo


More information about the Tutor mailing list