#!/usr/bin/env python # system include files # import sys import os import numpy as np # main: this is the main function of this Python # # int main(int argc, char** argv) # def main(argv): # my first python command # print("hello world") # my first python command # print(argv[0], argv[1], argv[2]) print(argv) print("argv[0] = %s [%s]" % (argv[0], argv[1]), "argv[2] = %s" % (argv[2])) X = float(55.0) print("today's temperature is %f degrees" % (X)) print("today's temperature is %10.4f degrees" % (X)) for arg in argv: X = float(2) print("...> arg = %s" % (arg)) print("the end of my loop") # C/C++ equivalent # #for (int i = 0; i < argc; i++) { # } # Python version # #for i in range(len(argv)): # print("%d: %s" % (i, argv[i])) # # end of main # begin gracefully # if __name__ == "__main__": main(sys.argv) # # end of file