[Tutor] What am I doing wrong...
Roger Merchberger
zmerch at 30below.com
Thu Dec 23 18:50:20 CET 2004
Rumor has it that Ken Stevens may have mentioned these words:
>I am a elative new comer to python. I wrote the following test
>snippet.
>
>#!/usr/bin/env python
>
>def main ():
> play_test()
>
>def play_test ():
> print "Hi! -- in play test"
>
>When I do "python test.py" absolutely nothing happens.
Correct.
>I expect it to do the print statement.
>Thanks in advance for your help.
You defined functions, but not the main code of the program, therefore it
does nothing.
Appended to your program, you need this:
### This defines where the actual program starts...
if __name__ == '__main__':
main()
### Now the program is done. ;-)
Hope this Helps!
Roger "Merch" Merchberger
--
Roger "Merch" Merchberger | Anarchy doesn't scale well. -- Me
zmerch at 30below.com. |
SysAdmin, Iceberg Computers
More information about the Tutor
mailing list