python - ipython 不添加新行
问题描述
考虑 ipython repl:
$ ipython
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
[ins] In [1]: x = 2
[ins] In [2]: y = 2
[ins] In [3]:
相反,考虑普通的python repl:
$ python
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 2
>>> y = 2
>>>
如您所见,ipython repl 添加了许多不必要的(我认为)新行语句,而 python repl 则更加简洁。
有没有办法可以禁用这些新行?(请注意,我知道这一点:https ://ipython.readthedocs.io/en/stable/config/details.html可以更改提示时显示的内容。但是,我找不到禁用选项提示之间的新行)
解决方案
ipython
从--nosep
选项开始。
$ ipython --nosep
Python 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: x = 1
In [2]: y = 2
In [3]: print(x, y)
1 2
In [4]:
来自ipython --help
:
--nosep
Eliminate all spacing between prompts.
也可以通过设置此配置选项来实现此行为:
c.InteractiveShell.separate_in = ''
推荐阅读
- python - 计算两行的 pearson 值时出错:len() of unsized object
- hl7-fhir - org.hl7.fhir.dstu3.model.Parameters 资源对象在扩展操作中不会水合/填充
- python - 当文件名与库名不匹配时将 DLL 链接到 Python 扩展
- amadeus - 最近的相关机场搜索未返回预期机场
- angular - 带有 qz 托盘的 Angular 6
- architecture - 微服务的功能分类与基于实体的分类
- javascript - 在动态值上使用 jQuery Mask 插件
- sql-server - SQL Server - 替换 - 匹配字符串与旧子字符串编辑整个字段?
- assembly - MASM 中的倒数计时器
- go - 我跑了 scp -i ssh “
. " 从我的客户端机器上使用 Go,但它返回 "没有这样的文件或目录"