root/hodgestar/PythonCode/SmallScripts/cnt.py
| Revision 408, 305 bytes (checked in by simon, 4 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | import sys |
| 2 | |
| 3 | f = file(sys.argv[1]) |
| 4 | |
| 5 | iCnt = 0 |
| 6 | for i, line in enumerate(f): |
| 7 | aParts = line.split(':') |
| 8 | if len(aParts) == 2: |
| 9 | try: |
| 10 | iCnt += int(aParts[1].strip()) |
| 11 | except ValueError, e: |
| 12 | logging.warn("Failed to parse count on line %d : %s" % (i+1, line)) |
| 13 | |
| 14 | print iCnt |
Note: See TracBrowser
for help on using the browser.
