On Sun, Nov 6, 2016 at 10:48 PM, SS wrote:
> # 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 w
On 11/6/2016 6:48 AM, SS wrote:
cmd="dig @4.2.2.2 %s ns +short", % (domname)
does not work.
No kidding. ', %' is a syntax error. The , makes a tuple, the % after
string does interpolation. You obviously want the latter so omit the ,.
The traceback should have pointed you to where the co
>
> 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