title: Read Value from Config File Python
body: <p>I have a file <code>.env</code> file contain 5 lines</p>
  
  <pre><code>DB_HOST=http://localhost/
  DB_DATABASE=bheng-local
  DB_USERNAME=root
  DB_PASSWORD=1234567890
  UNIX_SOCKET=/tmp/mysql.sock
  </code></pre>
  
  <p>I want to write python to grab the value of <strong>DB_DATABASE</strong>
  I want this <code>bheng-local</code></p>
  
  <hr>
  
  <p>I would have use </p>
  
  <pre><code>import linecache
  print linecache.getline('.env', 2)
  </code></pre>
  
  <p>But some people might change the order of the cofigs, that's why linecache is not my option. </p>
  
  <hr>
  
  <p>I am not sure how to check for only some strings match but all the entire line, and grab the value after the <code>=</code>.</p>
  
  <p>I'm kind of stuck here : </p>
  
  <pre><code>file = open('.env', "r")
  read = file.read()
  my_line = ""
  
  for line in read.splitlines():
      if line == "DB_DATABASE=":
          my_line = line
          break
  print my_line
  </code></pre>
  
  <p>Can someone please give me a little push here ? </p>