title: How do I properly create new files and apply multiple lines of input to it?
body: <p>I am trying to create 3 different files that I am then attempting to print ten random letters to print out 3 times in the file. 
  Here is my code:</p>
  
  <pre><code>import string
  import random
  
  for i in range(3):
      with open('data%i.txt' % i, 'w+') as f:
          line = 0
          while line &lt; 3:
              for j in range(10):
                  myStr = random.choice(string.ascii_lowercase)
                  f.write(myStr)
  
              line = line + 1
  </code></pre>
  
  <p>and output:</p>
  
  <pre><code>dfzanwalkccdipukrbwsrzrbheceqi
  </code></pre>
  
  <p>I've tried to print them with including the newline character in the file write, but that instead prints 30 lines with a single letter per line. Any help is appreciated!</p>