title: How do you delete extra \n's from a file?
body: <p>I am new to coding and am trying to make a function that will add the numbers given in a file. I have a solution that gives me the sum of the numbers but there is a &quot;None&quot; value being returned as well. How do I stop this from happening? My code looks like this</p>
  <pre><code>def addIntegersFromFile(file):
  
      newfile = file
      total = 0
      with open(newfile, 'r') as numbers:
          number = numbers.read()
          list1 = number.strip(&quot;\n&quot;)
          list2 = list1.split(&quot;\n&quot;)
      for value in list2:
          total += float(value)
      print(total)
  </code></pre>
  <p>It will return the sum of a file and then a new line with a &quot;None&quot; value.</p>
  <p>Ex:</p>
  <pre><code>6.0
  None
  </code></pre>