import csvimport sqlite3from glob import glob; from os.path import expanduserconn = sqlite3.connect( # open "places.sqlite" from one of the Firefox profiles glob(expanduser('~/.mozilla/firefox/*/places.sqlite'))[0])cursor = conn.cursor()cursor.execute("select * from moz_places;")#with open("out.csv", "w", newline='') as csv_file: # Python 3 version with open("out.csv", "wb") as csv_file: # Python 2 version csv_writer = csv.writer(csv_file) csv_writer.writerow([i[0] for i in cursor.description]) # write headers csv_writer.writerows(cursor)
PEP 249(DB API
2.0)具有有关的更多信息
cursor.description。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)