Note the following code:
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?
TIA.
--
https://mail.python.org/mailman/listinfo/python-list