![]() | The scripts convert1.py and convert2.py load and dump data - this functionality can be reproduced by an application script using convert3 |
![]() | The application script can be included in the module:
if __name__ == '__main__': import sys try: infilename = sys.argv[1] except: usage = 'Usage: %s infile' % sys.argv[0] print usage; sys.exit(1) y, dt = load_data(infilename) dump_data(y, dt) |
![]() | If the module file is run as a script, the if test is true and the application script is run |
![]() | If the module is imported in a script, the if test is false and no statements are executed |