Code for printing the entire history:
One-liner (quick copy and paste):
import readline; print('
'.join([str(readline.get_history_item(i + 1)) for i in range(readline.get_current_history_length())]))
(Or longer version...)
import readline
for i in range(readline.get_current_history_length()):
print (readline.get_history_item(i + 1))
One-liner (quick copy and paste):
import readline; print '
'.join([str(readline.get_history_item(i + 1)) for i in range(readline.get_current_history_length())])
(Or longer version...)
import readline
for i in range(readline.get_current_history_length()):
print readline.get_history_item(i + 1)
Note: get_history_item()
is indexed from 1 to n.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…