IPython常用魔法方法
来源:互联网 发布:淘宝招工 编辑:程序博客网 时间:2024/05/17 01:18
IPython常用魔法方法
复制代码,使用–退出
In :%cpastePasting code; enter '--' alone on the line to stop or use Ctrl-D.:
查看历史
In :hist -n 1: my_macro 2: hist -n 3: a = 1 4: b = 2 5: c = 36: hist -n
保存文件
In :save test.py 3-5File `test.py` exists. Overwrite (y/[N])? yThe following commands were written to file `test.py`:a = 1 b = 2 c = 3
编辑文件,会使用默认的编辑器
In :edit test.shEditing... done. Executing edited code...
导入文件
In :load test.shIn :!sh test.shto,121,112,223In :cat test.sh#!/bin/basharray_name=("to","121","112","223")for data in ${array_name[@]} do echo "$data"done
测试执行时间
In :%timeit for _ in range(10000): 110000 loops, best of 3: 173 µs per loopIn :%timeit for _ in xrange(10000): 110000 loops, best of 3: 119 µs per loopIn :time range(10)CPU times: user 3 µs, sys: 0 ns, total: 3 µsWall time: 3.81 µsOut:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
保持现场
In :logstart 1017.pyActivating auto-logging. Current session state plus future input saved.Filename : 1017.pyMode : backupOutput logging : FalseRaw input log : FalseTimestamping : FalseState : activeIn :a = 1In :b = 2In :c =3 In :c = 3In :logoffSwitching logging OFFroot@zidy ~ >> ipython -i 1017.py Activating auto-logging. Current session state plus future input saved.Filename : 1017.pyMode : backupOutput logging : FalseRaw input log : FalseTimestamping : FalseState : activeSwitching logging OFFIn :aOut:1In :bOut:2In :cOut:3
标记路径
In :%bookmarkUsageError: %bookmark: You must specify the bookmark nameIn :%bookmark book /root/book/In :cd book/root/bookIn :pwdOut:u'/root/book'
常用命令
? 显示方法参数,说明等?? 显示方法的源码_ 上一次的返回值
修改IPython提示符
ipython profile createmv /root/.ipython/profile_default/ipython_config.py /root/.ipython/profile_default/ipython_config.py1cp ipython_config.py /root/.ipython/profile_default/ipython_config.py
ipython_config.py需要下载,
阅读全文
0 0
- IPython常用魔法方法
- ipython常用方法说明
- ipython 常用功能
- IPython常用用法
- ipython及ipython notebook常用操作
- Python魔法方法--基本的魔法方法
- ipython常用功能, iPython 安装 比shell好用
- python中魔法属性和魔法方法
- PHP中的魔法方法
- PHP 魔法属性&方法
- Python中的魔法方法
- {python} 魔法方法
- python魔法方法
- 方法的开发魔法
- python中的魔法方法
- Python 魔法方法详解
- 魔法方法含义
- python__魔法方法
- java引用类型的强制类型转换
- Vue框架快速入门
- Hbase架构
- 系统库thrift的安装
- Faster RCNN训练出现问题:ValueError: operands could not be broadcast together with shapes
- IPython常用魔法方法
- 迭代求解最优化问题——梯度下降、牛顿法
- 构建机器学习项目(二)- ML strategy(2)
- Python--day1 Python的安装
- Mybatis的基本使用实例
- ZED stereo camera开发入门教程(2)
- 695. Max Area of Island
- 257. Binary Tree Paths
- 流水账笔记:PE文件格式(关于dump)