Skip to content

Commit

Permalink
Multiple file support
Browse files Browse the repository at this point in the history
  • Loading branch information
Zach Strudler committed Mar 6, 2012
1 parent c9af5e9 commit 72f8543
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions CappParser.py
Expand Up @@ -2,7 +2,7 @@


#Parses CAPP Reports into an sqlite file
#Usage: CappParser FILES
#Usage: CappParser [FILES]
from HTMLParser import HTMLParser
import sqlite3, glob, sys

Expand Down Expand Up @@ -79,12 +79,13 @@ def parse(file_name, c):
c.execute("replace into grades(id, prefix, num, name, grade) values (%d, '%s', %d, '%s', '%s')" % t)

def run():
if len(sys.argv) < 2:
print 'usage: %s FILES' % sys.argv[0]
print 'example: %s *.htm' % sys.argv[0]
if len(sys.argv) < 2 or '-h' in sys.argv[1:]:
print 'usage: %s [FILES]' % sys.argv[0]
print 'example: %s *.htm *.html' % sys.argv[0]
return

files = glob.glob(sys.argv[1])
files = []
for i in sys.argv[1:]: files += glob.glob(i)
if len(files) < 1: return

db = sqlite3.connect('grades.sqlite')
Expand Down

0 comments on commit 72f8543

Please sign in to comment.