title: Python: Iterating over two lists and replacing elements in one list1 with the element from list2
body: <p>I have two lists of strings. In list1, which contains around 1000 string elements, you have a string called "Date" that occurs randomly, immediately followed by a string that contains the a particular Date : "17/09/2011". This happens about 70 times. In List2: I have around 80 dates, as strings.</p>
  
  <p>Question : 
  I want to write a script that loops through both lists simultaneously, and replaces the dates in list1, with the dates in list2, in order. So, obviously you will have the first 70 dates of list2 replacing the the 70 occurrences of dates in list1.  Afterwards I want to write the modified list1 to a .txt file.</p>
  
  <p>I tried this, but I am totally stuck. I am super noob at Python.</p>
  
  <pre><code>def pairwise(lst):
      """ yield item i and item i+1 in lst. e.g.
          (lst[0], lst[1]), (lst[1], lst[2]), ..., (lst[-1], None)
      """
      if not lst: return
      #yield None, lst[0]
      for i in range(len(lst)-1):
          yield lst[i], lst[i+1]
      yield lst[-1], None
  
  for line in file:
        list1.append(line.strip())
  for i,j in pairwise(list1):
       for k in list2:
       if i == "Date":
           list1."replace"(j) # Dont know what to do. And i know this double for looping is wrong also.
  </code></pre>