> > import subprocess > import shlex > > domname = raw_input("Enter your domain name: "); > print "Your domain name is: ", domname > > print "\n" > > # cmd='dig @4.2.2.2 nbc.com ns +short' > cmd="dig @4.2.2.2 %s ns +short", % (domname) > proc=subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE) > out,err=proc.communicate() > print(out) > > The line that is commented out works fine. However, I want to substitute > a variable for "nbc.com". The command: > > cmd="dig @4.2.2.2 %s ns +short", % (domname) > > does not work. I've tried different variations to no avail. Any advice > on how to get that variable working? >
Two things: 1) Please explain what "does not work" mean. Are you getting an error message? If yes include the entire traceback. 2) The line /* cmd="dig @4.2.2.2 %s ns +short", % (domname) */ gives me a syntax error. Please copy-and-paste the exact commands you are entering. -- https://mail.python.org/mailman/listinfo/python-list