title: text file to dictionary as keys
body: <p>How can I convert file's words to dictionary as it's keys, directly, without using the list? Here is my code:</p>
  
  <pre><code>def abc(f):
      with open(f, "r")as f:
          dict = {}
          lst = []
          for line in f:
              lst += line.strip().split()
          for item in lst:
              dict[item] = ""
      return dict
  
  
  print(abc("file.txt"))
  </code></pre>
  
  <p>Example of input "file.txt":</p>
  
  <pre><code>abc def
  ghi jkl mno
  pqr
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>{"abc":"", "def":"", "ghi":"", "jkl":"", "mno":"", "pqr":""}
  </code></pre>
  
  <p>The output of split() is a list. So, by use of that I need to read the data from file, store it on a list and then define it as dictionary's keys. My question is how can we ignore the list, and after reading data from file, put them directly to the dictionary?  </p>