title: Command output parsing in Python
body: <p>I am trying to write a Python script on Windows 7, which reads the output of command <code>ipconfig /displaydns</code> and try to get some values from the output.  </p>
  
  <p>The output of <code>ipconfig /displaydns"</code>is something like this,</p>
  
  <pre><code>Windows IP Configuration
  
  9.a.c.e.x-0.19-430f5091.531.1518.1b8d.2f4a.210.0.k1m2t5a3245k242qmfp75spjkv.avts.
  
  Record Name . . . . . : 9.a.c.e.x-0.19-430f5091.531.1518.1b8d.2f4a.210.0.k1m2t5a3245k242qmfp75spjkv.avts.
  Record Type . . . . . : 1
  Time To Live  . . . . : 294
  Data Length . . . . . : 4
  Section . . . . . . . : Answer
  A (Host) Record . . . : 127.0.0.16
  </code></pre>
  
  <p>I am taking this output and saving it in a variable as below,</p>
  
  <pre><code>output = subprocess.check_output("ipconfig /displaydns", shell=True)
  </code></pre>
  
  <p>When I print "output" I get the following</p>
  
  <pre><code>b'\r\nWindows IP Configuration\r\n\r\n   9.a.c.e.x-0.19-430f5091.531.1518.1b8d.2f4a.210.0.k1m2t5a3245k242qmfp75spjkv.avts.\r\n    ----------------------------------------\r\n    Record Name . . . . . : 9.a.c.e.x-0.19-430f5091.531.1518.1b8d.2f4a.210.0.k1m2t5a3245k242qmfp75spjkv.avts.\r\n    Record Type . . . . . : 1\r\n    Time To Live  . . . . : 289\r\n    Data Length . . . . . : 4\r\n    Section . . . . . . . : Answer\r\n    A (Host) Record . . . : 127.0 .0.16\r\n\r\n\r\n'
  </code></pre>
  
  <p>From this output I am interested in the values for <code>A (Host) Record</code> and <code>Record Name</code> which are <code>127.0.0.16</code> and <code>9.a.c.e.x-0.19-430f5091.531.1518.1b8d.2f4a.210.0.k1m2t5a3245k242qmfp75spjkv.avts.</code> respectively.</p>
  
  <p>How would I do it in Python?</p>