title: How to multiply numbers from lines in a text file?
body: <p>I'm trying to write a piece of code that multiplies certain numbers from lines in a text file by 3. However, each line has string characters and each number is separated by commas. This is for a game leaderboard, I'm just trying to learn and practice Python. Each line has the player's nickname, matches played, matches won and matches lost listed respectively, each item is separated by a comma (no spaces) and each player has played 24 matches.</p>
  
  <p>A sample of a line from the text file is:</p>
  
  <pre class="lang-none prettyprint-override"><code>DarrenL,24,12,12
  Philippa93,24,9,15
  TommyBoy,24,0,24
  </code></pre>
  
  <p><strong>The Objective:</strong></p>
  
  <ul>
  <li>Read the text file into the code <strong>(done)</strong></li>
  <li>Take the matches won from each line and multiply it by three</li>
  </ul>
  
  <p>Here is the code I have already:</p>
  
  <pre><code>print("Leaderboard")
  print("Only players who have won one or more matches will be displayed")
  results = open('results.txt', 'r').readlines()
  with open('results.txt', 'r') as leaderboard:
      import re
      output = []
      with open('firesideResults.txt.txt') as file:
          for line in file:
              matchesWon = re.search(r'\d+,?\d*', line)
              if matchesWon:
                  points = output.append(float(matchesWon.group()))
                  print(points * 3)
  </code></pre>
  
  <p>The problem with the code is that it doesn't actually print anything from the actual text file.</p>