I want to take arguments with sys and do some operations but it is not clear how many arguments to write so how can I get all of them
can I use *
Look in the documentation.
Also that’s a very unspedific question. sys
is a library, no idea what “arguments” you want to take with that.
sys.argv
is a list containing all the arguments, with the program name in sys.argv[0]
. You can access the values in the same way you would any python list.
2 Likes
I’ll take binary numbers and convert them to decimal numbers.
I will run it from terminal like this:
python3 program.py “decimal_file” 11000 010011000…
I want to enter as many numbers as desired, so sys.argv[?] for me
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.