krebernisak
11/11/2013 - 7:11 PM

Python argument list manipulation

Python argument list manipulation

#!/usr/bin/env python

import sys

# Get the total number of args passed to the demo.py
total = len(sys.argv)

# Get the arguments list
cmdargs = str(sys.argv)

# Print it
print ("The total numbers of args passed to the script: %d " % total)
print ("Args list: %s " % cmdargs)