title: Taking user input for reading that many lines in a file
body: <p>I am trying to take a user input to read that many lines into a text file. I have this so far, but get this error: 
  in write_dogs line=f.next().strip() AttributeError: '_io.TextIOWrapper' object has no attribute 'next'</p>
  
  <p>This is my code as of now.</p>
  
  <pre><code>def write_dogs():
      total_cards = int(input("How many cards do you wish to play with? "))
      if total_cards %2 != 0:
          print("Please enter an even number")
          main_menu()
      elif total_cards &gt; 30 or total_cards &lt; 4:
          print("Please enter a number less that 30 and more than 4")
          main_menu()
      else:
          N = total_cards
          with open("dogs.txt") as f:
              with open("dogswrite.txt", "w") as f1:
                  for i in range(N):
                      line=f.next().strip()
                      f1.write(line)
  </code></pre>
  
  <p>Any help would be appreciated</p>
  
  <p>Working code is below</p>
  
  <pre><code>def write_dogs():
      total_cards = int(input("How many cards do you wish to play with? "))
      if total_cards %2 != 0:
          print("Please enter an even number")
          main_menu()
      elif total_cards &gt; 30 or total_cards &lt; 4:
          print("Please enter a number less that 30 and more than 4")
          main_menu()
      else:
          N = total_cards
          with open("dogs.txt") as f:#opens needed file
              with open("dogswrite.txt", "w") as f1:#my own file to later create a class
                  for i in range(N):
                      line=next(f).strip()#lists the input number of results each on a new line
                      line = line + "\n"
                      f1.write(line)
  </code></pre>