title: Import a file as a dict() in Python 3
body: <p>I have a file I was playing around with to see if I can import it and convert it to a Python dictionary. </p>
  
  <p>It is the default <code>pyenv.cfg</code> file in <code>venv</code>. It reads:</p>
  
  <pre><code>home = C:\Users\nope\AppData\Local\Continuum\anaconda3
  include-system-site-packages = false
  version = 3.6.4
  </code></pre>
  
  <p>I tried using:</p>
  
  <pre><code>with open(file, mode='r', encoding='utf-8') as f:
      new_f = f.read().replace('=', ':')
      d = dict(new_f)
  </code></pre>
  
  <p>This tells me I don't have enough arguments for dict(). It expects 2. I'm familiar with using <code>dict(zip(list_1, list_2))</code> to create a dictionary. I'm not familiar with opening a file and creating one.</p>
  
  <p>I'm looking for a very simply way to do this. I did some research with <code>re</code> and it isn't turning out. Withing the <code>with</code> block, I ran <code>a = f.read().replace(' = ', '\',\'')</code> which returns:</p>
  
  <pre><code>home','C:\Users\nope\AppData\Local\Continuum\anaconda3
  include-system-site-packages','false
  version','3.6.4
  </code></pre>
  
  <p>Now I need to add a <code>'</code> at the beginning and end of each line. Then I think I can use <code>f.readlines()</code> to create a list I can slice into keys and values. I know how to do this with <code>vim</code> or <code>sed</code> in Linux, but I'm trying to stay within Python. </p>
  
  <p>Please help. Thank you!</p>