title: Two first columns of text file as a dictionary
body: <p>I would like to define a dictionary using the 2 first columns of a text file (with a tab delimiter). </p>
  
  <p>Using the following code, I create a dictionary "dict" in which the keys are the rows in the first column and the values are the rows in the second and third columns:</p>
  
  <pre><code>mydict = {}
  with open("myfile.txt") as f:
      mydict = dict(x.split(" ", 1) for x in f)
  </code></pre>
  
  <p>However, I would like to discard the third column and use the first column as a key and the second as a value in the dictionary "dict". I tried this code but it does not work for me:</p>
  
  <pre><code>mydict = {}
  with open("myfile.txt") as f:
      mydict = dict(x.split(" ", 2)[0:1] for x in f)
  </code></pre>
  
  <p>Any suggestions are welcome, thanks!</p>