Advertisement

ipython中%history用于快速查找历史命令

阅读量:

1、完整呈现所有过往记录,并附带编号

复制代码
     %history -n
    
     150: %cpaste
     151: %cpaste
     152: print(r">>>>>>>>>")
     153: print(r'>>>>>>>>>')
     154: print(r'>>>>>>>>><')
     155: print(r'>')
     156: print(r'>>')
     157: print(r'>>>')
     ...
    
    
    AI写代码python
    

2、依据编号顺序,检索特定编号范围内的历史记录

复制代码
     %history -n 168-170 178 185-190
     
     168: planets
     169:
    for method, group in planets.groupby('method'):
    print(f'{method:30s} method={group}')
     170

全部评论 (0)

还没有任何评论哟~