欢迎来到 AI 中文社区(简称 AI 中文社),这里是学习交流 AI 人工智能技术的中文社区。 为了更好的体验,本站推荐使用 Chrome 浏览器。
全部教程·
Python语言·
Jupyter
[目录]
·
IPython shell代码
Jupyter 教程
IPython 安装
IPython 启动
IPython 运行脚本
IPython 历史命令
IPython 系统命令
IPython 命令行选项
IPython 动态对象自省
IPython IO缓存
IPython 环境变量
IPython shell代码
IPython 嵌入
IPython 魔术命令
Jupyter 项目
Jupyter 笔记本
Jupyter 在线使用
Jupyter 安装与入门
Jupyter 仪表盘
Jupyter 用户界面
Jupyter 单元格类型
Jupyter 编辑
Jupyter Markdown
Jupyter 魔术功能
Jupyter 绘图
Jupyter 转换
Jupyter IPyWidgets
Jupyter QtConsole入门
QtConsole 多行编辑
QtConsole 嵌入式图形
QtConsole 保存为HTML
QtConsole 多个控制台
Jupyter 笔记本连接
Jupyter 笔记本共享
JupyterLab 概述
JupyterLab 安装和入门
JupyterLab 界面
JupyterLab 安装R内核
Jupyter 教程
IPython 安装
IPython 启动
IPython 运行脚本
IPython 历史命令
IPython 系统命令
IPython 命令行选项
IPython 动态对象自省
IPython IO缓存
IPython 环境变量
IPython shell代码
IPython 嵌入
IPython 魔术命令
Jupyter 项目
Jupyter 笔记本
Jupyter 在线使用
Jupyter 安装与入门
Jupyter 仪表盘
Jupyter 用户界面
Jupyter 单元格类型
Jupyter 编辑
Jupyter Markdown
Jupyter 魔术功能
Jupyter 绘图
Jupyter 转换
Jupyter IPyWidgets
Jupyter QtConsole入门
QtConsole 多行编辑
QtConsole 嵌入式图形
QtConsole 保存为HTML
QtConsole 多个控制台
Jupyter 笔记本连接
Jupyter 笔记本共享
JupyterLab 概述
JupyterLab 安装和入门
JupyterLab 界面
JupyterLab 安装R内核
IPython shell代码
IPython 可以使用默认的 >>> 提示符和另一个 IPython 会话从标准 Python 控制台读取。以下屏幕截图显示了用标准 Python Shell 编写的 for 循环:

复制代码(以及Python提示)并将其粘贴到 IPython 输入单元格中。 IPython 会智能地过滤输入提示(>>>和...)或 IPython 的提示(在[N]:和...:)

同样,可以将一个 IPython 会话中的代码粘贴到另一个会话中。下面给出的第一个屏幕截图显示了在一个 IPython 窗口中 SayHello() 函数的定义:

现在,让我们选择代码并粘贴到另一个 IPython shell 中,然后调用 SayHello() 函数。

下一章:IPython 嵌入
通过 IPython 模块的 embed() 函数,可以将 IPython 嵌入到 Python 代码的命名空间中。因此,您可以在默认的Python环境中利用IPython功能,例如对象自省和制表符完成。在嵌入之前,存 ...
AI 中文社