]>
gitweb.pimeys.fr Git - scripts-20-100.git/blob - extract_ipython.py
2 # -*- encoding: utf-8 -*-
4 """ Pour récupérer le contenu de l'historique ipython """
16 sessionid
= "(SELECT max(session) FROM sessions) - %s" % (-n
)
20 req
= 'SELECT * FROM history WHERE session=%s;' % sessionid
24 history_file
= os
.path
.expanduser('~/.config/ipython/profile_default/history.sqlite')
25 if not os
.path
.isfile(history_file
):
26 history_file
= os
.path
.expanduser('~/.ipython/profile_default/history.sqlite')
28 c
= sqlite3
.connect(history_file
)
31 for line
in iter(r
.fetchone
, None):
32 print line
[-1].encode('utf-8')