Assign the converted integers to these variables:
num1 = int(argv[1]) #assign the return int to num1 num2 = int(argv[2])
The execution is simple:
int(argv[1]) int(argv[2])
does not affect the original elements, since int returns a new int object, elements inside sys.argv do not affect this.
Yo change the original list you can do:
argv[1:] = [int(x) for x in argv[1:]] file_name, num1, num2 = argv
source share