w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Command line arguments, sys.argv

As @jonsharpe said in his comment, the program you provided runs as follows:

  1. Load a reference to module sys, get the element argv and store it in the global variables.
  2. Take the argv global variable and unpack its values, then save each of its values in order: save the 1st in script, the 2nd in first, the 3rd in second, and 4th in third. This step may throw errors when not enough values can be unpacked to store in the variables.
  3. Print the string The script is called: followed by the value that script holds. If script contains a non-string value, the value of str(script) is written.
  4. Print the string Your first variable is: followed by the value that first holds.
  5. Print the string Your second variable is: followed by the value that second holds.
  6. Print the string Your third variable is: followed by the value that third holds.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.