put returns between paragraphs
► for linebreak add 2 spaces at end
► italic or bold
► indent code by 4 spaces
► backtick escapes like _so_
► quote by placing > at start of line
► to make links (use https whenever possible) https://example.com
put returns between paragraphs
► for linebreak add 2 spaces at end
► italic or bold
► indent code by 4 spaces
► backtick escapes like _so_
► quote by placing > at start of line
► to make links (use https whenever possible) https://example.com
sys.argv
is a list containing the program as invoked, and the arguments passed to it.
You've invoked the program as python3 proj.py
, which means that sys.argv == ['proj.py']
.
You then asked the program to access the second element of sys.argv
via sys.argv[1]
. There is no second element, so this fails with the given error.
Had you invoked the program as python3 proj.py foo
, then sys.argv == ['main.py', 'foo']
and sys.argv[1] == 'foo'
.