String format function does not parse my slashes character?
Question: I am doing a small python script to perform a wget call, however I am
encountering an issue when I am replacing the string that contains the url/ip
address and that it will be given to my "wget" string

    
    
    import os
    import sys 
    
    usr = sys.argv[1]
    pswd = sys.argv[2]
    ipAddr = sys.argv[3]
    
    wget = "wget  http://{IPaddress}"
    wget.format(IPaddress=ipAddr)
    print "The command wget is %s" %wget
    
    os.system(wget)
    

If I run that script I get the snippet below, wher I know that wget fails,
because the variable ipAddr has not replaced IPaddress pattern, so I guess
that the issue has to do with the slashes in the url. My question is why that
pattern is not replaced?

    
    
    python test.py 1 2  www.website.org  The command wget is wget  http://{IPaddress}
    
    --2015-12-03 20:26:11--  http://%7Bipaddress%7D/
    
    Resolving {ipaddress} ({ipaddress})... failed: Name or service not known.
    


Answer: You aren't assigning the result of the `format` call to anything - you're just
throwing it away. Try this instead:

    
    
    wget = "wget  http://{IPaddress}"
    wget = wget.format(IPaddress=ipAddr)
    print "The command wget is %s" %wget
    
    os.system(wget)
    

Alternatively, this seems a bit cleaner:

    
    
    wget = "wget  http://{IPaddress}".format(IPaddress=ipAddr)
    print "The command wget is %s" %wget
    
    os.system(wget)
    

