title: Script to validate domains
body: <p>Objective is to read a list of domains from a file and perform lookup to confirm reachability and resolution from my end.</p>
  
  <p>This is what I have written:</p>
  
  <pre><code>#!/usr/bin/python
  
  import os
  import socket
  
  f = open('file1.lst', 'r')
  s = f.readlines()
  
  for i in s:
      print i
      socket.gethostbyname(i.strip())
  
  f.close()
  </code></pre>
  
  <p><code>socket.gethostbyname()</code> line throws an exception.</p>