[Tutor] How to run a .py file or load a module?

Alan Gauld alan.gauld at btinternet.com
Mon Apr 27 21:32:19 CEST 2009


Offlist response...

Nice answer Denis, you neatly covered all the loose ends from
previous answers that I was just about to pick up on! :-)

"spir" <denis.spir at free.fr> wrote in message 
news:20090427101523.5fc09539 at o...
> Le Sun, 26 Apr 2009 22:35:36 +0100,
> Dayo Adewunmi <contactdayo at gmail.com> s'exprima ainsi:
>
>> How can I
>>
>> a) Open my shell, and do something like: $ python countdown.py
>> but have it take an argument and pass it to the function, and execute.
>
> When your code is (nicely) organised as a set of funcs or class
> definitions, you also need a "laucher" usually called "main()".

Only question is why, after saying it's usually called "main" that you
chose "launch"?! :-)

Alan G.





More information about the Tutor mailing list