I am originally a C programmer. I have seen numerous tricks and "hacks" to read many different arguments.
What are some of the ways Python programmers can do this?
import sys print(" ".join(sys.argv))
sys.argv is a list that contains all the arguments passed to the script on the command line. sys.argv[0] is the script name.
sys.argv
sys.argv[0]
Basically,
import sys print(sys.argv[1:])
1.4m articles
1.4m replys
5 comments
56.9k users