Open lcabrini opened 9 years ago
having difficulty with this issue. Kindly help out please.
have you written any code for this? if so, so a commit but without adding closes #16. Instead type ref #16
I'm not sure where you are struggling. Maybe if I see some code I'll know better.
In the sys module there is a list called argv which gives access to command-line arguments. Actually sys.argv[0] gives you the name of the script. The command-line arguments start from sys.argv[1]. If you want to know the number of elements in argv you can use.
If you want to know the number of command-line arguments especially you rather use:
This is called slicing, sys.argv[1:] will start from index 1. You can use this to iterate through the arguments with
Write a program, called args.py that prints the name of the script, the number of command-line arguments the program received and list the arguments as well. Here is an example of the output you should get: