Ipython操作指南Ipython操作指南.pdf
文本预览下载声明
摘自网络大侠摘自网络大侠—雨痕。雨痕。感谢感谢。。
摘自网络大侠摘自网络大侠 雨痕雨痕。。感谢感谢。。
IPython Magic Functions
[ 2010-07-19 22:03:24 | 作者: yuhen ]
字号: 大 | 中 | 小
将 IPython 用熟了,可以轻松在试验、编码、测试间 无缝折腾。
$ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
Type copyright, credits or license for more
information.
IPython 0.10 -- An enhanced Interactive Python.
? - Introduction and overview of IPythons features.
%quickref - Quick reference.
help - Pythons own help system.
object? - Details about object. ?object also works, ??
prints more.
(在 Mac OS X 下使用时记得安装 readline)
1. 帮助帮助
帮助帮助
?: 查看对象信息。
??: 获取更详细的信息,比如源代码。
%quickref: IPython 简易手册。
%magic: IPython Magic 详细手册。
%lsmagic: 所有可用的 Magic 函数。
? 和 ?? 是 IPython 中最常用的命令。
In [96]: test ?
Type: function
Base Class: type function
String Form: function test at 0x190e1b8
Namespace: Interactive
File: /home/yuhen/test/test.py
Definition: test()
Docstring:
no docstring
In [97]: test ??
Type: function
Base Class: type function
String Form: function test at 0x190e1b8
Namespace: Interactive
File: /home/yuhen/test/test.py
Definition: test()
Source:
def test():
pass
2. 系统系统
系统系统
%alias: 显示或定义系统命令别名。
%unalias: 删除别名。
%sc: 执行系统命令,并将输出结果存储到变量。
%sx: 执行系统命令,并将输出结果分割存储成列表。
(1) 定义别名和 shell 下的意思差不多。
In [13]: %alias
Total number of aliases: 15
Out[13]:
[(cat, cat),
(clear, clear),
(less, less),
(mkdir, mkdir),
(rmdir, rmdir),
(cp, cp -i),
(lc, ls -F -o --color),
(ldir, ls -F -o --color %l | grep /$),
(lf, ls -F -o --color %l | grep ^-),
(lk, ls -F -o --color %l | grep ^l),
(ll, ls -lF),
(ls, ls -F),
(lx, ls -F
显示全部