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

Richard D. Moores rdmoores at gmail.com
Mon Aug 2 00:53:17 CEST 2010


On Sun, Aug 1, 2010 at 15:00, Richard D. Moores <rdmoores at gmail.com> wrote:
> On Sun, Aug 1, 2010 at 14:44, Daniel Sarmiento <dsarmientos at gmail.com> wrote:
>>

>> Without knowing what your code does, I think it will be something like:
>>
>> try:
>>     F_unused = open(path1, 'rb')
>>     F_used = open(path2, 'rb')
>> except IOError:
>>     print("no")
>>     .....
>> else:
>>     unused_ints = pickle.load(F_unused)

OK. Did that. And it works: <http://tutoree7.pastebin.com/EDgwU6Ac>.
Now what? Am I done? Or should I break it up into a bunch of
functions, each one doing just one thing?

Dick


More information about the Tutor mailing list