Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'output': 0.04; 'subject:Python': 0.05; 'lines,': 0.05; 'be:': 0.09; 'formatted': 0.09; 'postgres': 0.09; 'record.': 0.09; 'django': 0.10; 'files.': 0.13; 'file:"': 0.16; 'iterates': 0.16; 'row': 0.16; 'subject:loss': 0.16; "team's": 0.16; 'win,': 0.16; 'received:10.0.1': 0.17; 'thanks,': 0.18; 'file.': 0.20; 'trying': 0.21; 'example': 0.23; 'project,': 0.24; 'script': 0.24; 'guess': 0.27; 'subject:/': 0.28; 'run': 0.28; 'record': 0.28; 'finds': 0.29; 'teams,': 0.29; "i'm": 0.29; "we're": 0.30; 'received:209.85.210.174': 0.30; 'received:mail- iy0-f174.google.com': 0.30; 'saves': 0.30; 'up.': 0.31; 'code': 0.31; 'file': 0.32; 'running': 0.32; 'handle': 0.33; 'received:10.0': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'loss': 0.34; 'skip:k 20': 0.35; 'received:209.85': 0.35; 'next': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'received:209': 0.37; 'data': 0.37; 'store': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'lost': 0.60; 'first': 0.61; 'header :Message-Id:1': 0.62; 'results': 0.65; 'total': 0.65; 'records.': 0.65; 'talking': 0.66; 'sports': 0.69; 'confusing': 0.84; "it'd": 0.84; 'moves': 0.84; 'ohio': 0.84; "they'd": 0.84; 'subject:records': 0.91; 'outcome': 0.93; 'won': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version:x-mailer; bh=gR7ora7+MgI5d3I7HxJcIkUYj9LN4TnSzIvLAaAjLpE=; b=t7m2Z8ACxl7OQeYvOdl4El+CCvWyiKKCWOPzfmx+nIPsffWV4s0RPMeg6HAy1nep2x P5GftZQJ84IKk5FVOtlUSpKFmeFDtZDaATXDHGzVDtq6gtVzhUdPJMCseXmPgoE8LX1D ZgFSosDFKVyKv8QliXgqavv8fmSCEEXzzzRUne2FHbY2v8wDeKeQlmdhPvbQ2iATYAU0 PT7VNzZgM0UNcNCS49u6wALvC+GmrfCvYbT96ffKLs+o2SxkXO7abTLH4XyvCjjBc3M3 RwA1L3n4T+GPr7SP7Diu6MRvox937DAtVL89lmuX+SCkpTuJamsXGI0xJY0Lgwul7pBy LkPw== From: Christopher McComas Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Computing win/loss records in Python Date: Sat, 25 Aug 2012 22:20:05 -0400 To: python-list@python.org Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) X-Mailer: Apple Mail (2.1486) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345947609 news.xs4all.nl 6960 [2001:888:2000:d::a6]:41363 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27894 Greetings, I have code that I run via Django that grabs the results from various = sports from formatted text files. The script iterates over every line in = the formatted text files, finds the team in the Postgres database = updates their w/l record depending on the outcome on that line, saves = the team's row in the db, and then moves on to the next line in the = file.=20 I'm trying to get away from Django for this project, I want to run the = files, get the W/L results and output a formatted text file with the = teams and their W/L records. What's confusing me I guess how to store = the data/results as the wins and losses tally up. We're talking hundreds = of teams, thousands of games, but a quick example would be: Marshall Ohio State Kentucky Indiana Marshall,24,Ohio State,48, Kentucky,14,Indiana,10, Marshall,10,Indiana,7, Ohio State,28,Kentucky,10 That's just a quick example, I can handle seperating the data in the = lines, figuring it all out, I just am unsure of how to keep a running = total of a team's record. I would do "for line in file:" then on the = first line I see that Marshall lost so they would have 1, Ohio State won = so they'd have 1 win. It'd go to the next line Kentucky 1 win, Indiana 1 = loss, then on the 3rd line, Marshall got a win so they'd have 1 win, but = it would have to remember that loss from line 1... Does this make sense? Thanks,=