title: Using the dig command in python
body: <p>Just a forewarning, my python skills are almost nonexistent, but I’m trying to learn as I go.</p>
  
  <p>I'm doing a few changes via our DNS control panel over the weekend to about 58 CNAMES (just changing the destination)</p>
  
  <p>And rather than checking the changes have gone live for each individual record I was wondering if there was a way to script a list of digs for each CNAME in python?</p>
  
  <p>The dig command I use would be something like this </p>
  
  <pre><code>dig @ns1.netnames.net www.rac.co.uk CNAME
  </code></pre>
  
  <p>and I would expect to see <code>rac-secure.gslb2.rac.co.uk</code> returned.</p>
  
  <p>I tried something like:</p>
  
  <pre><code>import os
  os.system( 'dig&lt;exampledomain.com&gt;'CNAME )
  </code></pre>
  
  <p>But that didn't appear to work (as I mentioned my python skills are lacking), am I on the right path, or should I be using something like dnspython? I have used the dnspython module before with (a lot) of help from the stack overflow community but I find the documentation really confusing.</p>
  
  <p>Any pointers in the right direction would be greatly appreciated.</p>
  
  <p>Regards</p>
  
  <p>Chris.</p>