title: Print output in one line and grouped Python
body: <p>After running two of my loops:</p>
  
  <pre><code>for word in words:
      for i in range (1,p+1):
          print(word,len(re.findall(word, input_[i])),i)
  </code></pre>
  
  <p>I am getting example result like this:</p>
  
  <pre><code>businesses 0 1
  businesses 0 2
  businesses 2 3
  </code></pre>
  
  <p>But I would like achieve this:</p>
  
  <pre><code>businesses 0 1 0 2 2 3
  </code></pre>
  
  <p>I can get this result by this:</p>
  
  <pre><code>for word in words:
          print(word,len(re.findall(word, input_[i])),i,len(re.findall(word, input_[i+1])),i+1,len(re.findall(word, input_[i+2])),i+2)
  </code></pre>
  
  <p>But it's not the point because <code>p</code> can be dynamically changed so i don't want to use static values like <code>i+1 i+2</code>....</p>
  
  <p>I will be gratefull for any help and suggestions.</p>