[Tutor] How to run a .py file or load a module?
David
david at abbottdavid.com
Mon Apr 27 03:33:54 CEST 2009
Norman Khine wrote:
> On Mon, Apr 27, 2009 at 12:07 AM, Sander Sweers <sander.sweers at gmail.com> wrote:
Here is another one for fun, you run it like
python countdown.py 10
#!/usr/bin/env python
import sys
from time import sleep
times = int(sys.argv[1]) # The argument given on the command line
def countdown(n):
try:
while n != 1:
n = n-1
print n
sleep(1)
finally:
print 'Blast Off!'
countdown(times)
More information about the Tutor
mailing list