2008年9月22日星期一

Example program

#!/usr/bin/python
import times, sys
if len(sys.argv) == 2:
print ’importing the times module’
print times.multiplyby10(sys.argv[1])


Example program
note that the module times takes a string and adds a
’0’ to the left hand side
effectively multiply by 10
note it also uses the if __name__ ==
"__main__": condition which only calls the
multiply routine if this module was invoked as the
main program by the user

没有评论: