import sqlite3 JList = [] class MyJournal: def __init__(self,id,name): self.id = id self.name = name def description(self): return "Journal number: " + str(self.id) + " has the name " + self.name conn = sqlite3.connect('academic_papers_populated.db') cursor = conn.cursor() for row in cursor.execute('''SELECT * FROM Journal;'''): JList.append(MyJournal(row[0],row[1])) cursor.close()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter