Crush <[email protected]> Wrote in message:
> My code is as follows...
>
> count = 0
> while count < 3:
> count += 1
> subprocess.Popen('command')
> if count == 3:
> sys.exit()
>
>
The line beginning "subp" is indented further than the one before
it, so this script would terminate with an indentation error.
Once you've fixed that we should look at the if statement. If the
count is 3 it calls sys.exit. But of course count is 3, or we
wouldn't have finished the while loop. And you terminate anyway
when you fall off the end of the script. So why call sys.exit
()
Finally, if you just want to something 3 times, why not use a for
loop?
for count in range (3):
subproc...
--
DaveA
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor