From: Vincent Le Gallic Date: Sat, 18 Oct 2014 12:32:00 +0000 (+0200) Subject: Pour dumper la dernière session ipython X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;h=91292820e39f1cea0bcec57434d7dbb1c5e68ed3;p=scripts-20-100.git Pour dumper la dernière session ipython --- diff --git a/extract_sess.py b/extract_sess.py new file mode 100755 index 0000000..c7c2016 --- /dev/null +++ b/extract_sess.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +import sqlite3 +import os + +c = sqlite3.connect(os.path.expanduser('~/.ipython/profile_default/history.sqlite')) + +r = c.execute('select * from history where session=(select max(session) from sessions);') + +for line in iter(r.fetchone, None): + print line[-1].encode('utf-8')