Python----ipython

来源:互联网 发布:gamemaker for mac 编辑:程序博客网 时间:2024/05/17 04:58

功能:

  • 支持自动补全, 交互式的数据可视化工具
  • 自动缩进
  • 支持bash shell 命令, 是基本 BSD 开源的
  • Jupyter 内核
  • 灵活、可嵌入的解释器
  • 内置了许多很有用的功能和函数
python abc.pypython3 abc.pyexit()      # 退出ipython     exit        # 退出

查看其支持的方法, 如:

C:\Windows\System32>ipythonPython 3.6.0b1 (default, Sep 12 2016, 18:11:36) [MSC v.1900 64 bit (AMD64)]Type 'copyright', 'credits' or 'license' for more informationIPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.In [1]: list = []In [2]: list.              append()  count()   insert()  reverse()              clear()   extend()  pop()     sort()              copy()    index()   remove()In [3]: str = "s"In [4]: str.       capitalize()   format()       islower()      lower()        rpartition()   title()       casefold()     format_map()   isnumeric()    lstrip()       rsplit()       translate()       center()       index()        isprintable()  maketrans()    rstrip()       upper()       count()        isalnum()      isspace()      partition()    split()        zfill()       encode()       isalpha()      istitle()      replace()      splitlines()       endswith()     isdecimal()    isupper()      rfind()        startswith()       expandtabs()   isdigit()      join()         rindex()       strip()       find()         isidentifier() ljust()        rjust()        swapcase()

魔术命令

命令               说明%quickref        显示IPython的快速参考%magic           显示所有魔术命令的详细文档%debug           从最新的异常跟踪的底部进入交互式调试器%hist            打印命令的输入(可选输出)历史%pdb             在异常发生后自动进入调试器%paste           执行剪贴板中的Python代码%cpaste          打开一个特殊提示符以便手工粘贴待执行的Python代码%reset           删除interactive命名空间中的全部变量/名称%page OBJECT      通过分页器打印输出OBJECT%run script.py    在IPython中执行一个Python脚本文件%prun statement   通过cProfile执行statement,并打印分析器的输出结果%time statement    报告statement的执行时间%timeit statement   多次执行statement以计算系综平均执行时间。对那些执行时  间非常小的代码很有用%who、%who_ls、%whos  显示interactive命名空间中定义的变量,信息级别/冗余度可变%xdel variable       删除variable,并尝试清除其在IPython中的对象上的一切引用

win 下需要安装, 步骤:

  1. 需要先下载pip pip.9.0.1.tag.gz工具: https://pypi.python.org/pypi/pip#downloads
  2. 解压后命令行安装: python setup.py install
  3. 为方便操作一般要配置环境变量: C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts
  4. 测试: 在命令行输入: ipython

ubuntu 安装:

sudo apt-get install ipython 通过 ipython 启动。