Python command line argument defaults
Question: I just wondered if there was a simple way to set a python command-line
argument using sys.argv as a default. For example;

    
    
    sys.argv[2] = "defaultValue"
    

I know that in some other languages, you can do the following if it's blank;

    
    
    var myVar = "someValue" | "";
    

I am fairly new to Python but would love a simple solution to this. Thanks in
advance ;)


Answer: You can top up the argument list so you have at least two arguments and then
assign the correct value to `argsv[2]`:

    
    
    import sys
    sys.argv= sys.argv + ["" for x in range(2) ]
    sys.argv[2]="defaultValue"
    print sys.argv
    

