python

Command-Line Program SpecificationCode to be run and command-line arguments to send to it are specified in the following ways in      Python command lines:scriptfileDenotes the name of a Python script file to run as the main,            topmost file of a program (e.g., python            main.py runs the code in            main.py). The script’s name may            be an absolute or relative (to “.”) filename path, and is made            available in sys.argv[0]. On            some platforms, command lines may also omit the            python component if they begin with a            script file name and have no options for Python itself.-c          commandSpecifies Python code (as a string) to run (e.g.,            python -c            "print('spam' * 8)" runs a Python print operation).            sys.argv[0] is set to '-c'.-m          moduleRuns a module as a script: searches for            module on sys.path and runs it as a top-level file            (e.g., python -m pdb s.py runs the Python debugger            module pdb located in a            standard library directory, with argument s.py). module            may also name a package (e.g., idlelib.idle). sys.argv[0] is set to the module’s full            path name.−Reads Python commands from the standard input stream, stdin (the default); enters interactive            mode if stdin is a “tty”            (interactive device). sys.argv[0] is set to '−'.arg*Indicates that anything else on the command line is passed to the            script file or command, and appears in the built-in list of            strings sys.argv[1:].If no scriptfile,      command, or module      is given, Python enters interactive mode, reading commands from      stdin (and using GNU readline for input, if installed), and      setting sys.argv[0] to '' (the empty string) unless invoked with      option – in the preceding      list.Besides using traditional command lines at a system shell prompt, you can      also generally start Python programs by clicking their filenames in a      file explorer GUI; by calling functions in the Python standard library      (e.g., os.popen()); by using      program-launch menu options in IDEs such as IDLE, Komodo, Eclipse, and      NetBeans; and so on.

No comments:

Post a Comment

Office hours tomorrow(Tuesday) 5:00pm-6:00pm, 4/26/2021, 5:13 PM, English, 4/26/2021, 5:13 PM

Your assigned language is: English Classroom blog: googleclouduconn.blogspot.com 4/26/2021, 5:13 PM Office hours tomorrow(Tuesday) 5...