title: Iterate over combinations of items of multiple lists in Python
body: <p>I have several lists and I need to do something with each possible combination of these list items. In the case of two lists, I can do:</p>
  
  <pre><code>for a in alist:
    for b in blist:
      # do something with a and b
  </code></pre>
  
  <p>However, if there are more lists, say 6 or 7 lists, this method seems reluctant. Is there any way to elegantly implement this iteration?</p>