title: How to combine several lists and put them as a single key into a dictionary?
body: <p>I'm creating a mini search engine in python language. For that I need to resolve the following problem. I have basically a text which is made of several parts separated by <code>"[==========]"</code>. </p>
  
  <p>Like :</p>
  
  <pre><code>[blablabla][blabliblou][==========][blablablou][blibloubla][=========][oubabababa][baboulila]
  </code></pre>
  
  <p>I want to create an algorithm that combine these lists until we "hit" a "=========="and put them into a dictionary as a single key with the value "1" for the first lists, value "2" for the two following lists etc...</p>
  
  <p>To be honest, I tried a lot of things but I couldn't resolve the problem.
  Could you help me ?</p>
  
  <p>I tried to create conditionals loops using for and while</p>
  
  <pre><code>file = open("mytext.txt","r", encoding="utf-8")
  
  dico = {}
  counter = 0
  
  for ln in file:
      x = ln.split()
      for x in file:
          print(dico)
          while x != "==========":
             dico[x] = counter
          else:
              dico[x] = counter + 1
  
  print (dico)
  </code></pre>
  
  <p>The dictionary is still empty, I don't know why!</p>