Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyodbc
- dbfile = 'C:/Logs/N6ML/dxkmega.mdb'
- cnx = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=%s' % (dbfile))
- cursor = cnx.cursor().execute("select Call,[Band] from QSOs;")
- by_call = {}
- for call, band in cursor.fetchall():
- by_call.setdefault(call, set())
- by_call[call].add(band)
- for call, bands in by_call.items():
- if len(bands) >= 9:
- srt = sorted(bands, key=lambda x: int(x[:-1]))
- print('%s has been worked on %d bands: %s' %
- (call, len(bands), ' '.join(srt)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement