IPython - 单行间距可能吗?
默认情况下,IPython shell 在输入之间显示一个空行:
In [1]: 1 + 1
Out[1]: 2
In [2]: import math
In [3]: math.sqrt(2)
Out[3]: 1.4142135623730951
In [4]:
是否有任何方法可以配置 IPython shell,使其不会在每个命令历史记录之间产生空行?这将显着增加我可以在屏幕上看到的历史记录量。
By default, the IPython shell shows a blank line between inputs:
In [1]: 1 + 1
Out[1]: 2
In [2]: import math
In [3]: math.sqrt(2)
Out[3]: 1.4142135623730951
In [4]:
Is there any way to configure the IPython shell so that it does not produce a blank line between each command history? This would significantly increase the amount of history I would be able to see on my screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 Mac 用户,可以在以下位置找到永久编辑的配置文件配置:
/Users/(您的用户名)/.ipython/profile_default/ipython_config.py
对于 Linux 用户,这可能是几乎相同的路径,但使用 /home/ 而不是 /Users/。在命令行中使用“~”在任何一种情况下都可以工作(例如~/.ipython/...)。
取消注释第 164 行并删除换行符,因此它表示:
虽然这是一个老问题,但它仍然与通过 Google 找到它的其他用户(例如我自己)相关,所以我想为 Mac 和 Mac 添加此答案。 Linux 用户。
For Mac users, the profile config to permanently edit this can be found in:
/Users/(your username)/.ipython/profile_default/ipython_config.py
For linux users, it's probably a nearly identical path, but with /home/ instead of /Users/. Using '~' in the command line will work in either case, (e.g. ~/.ipython/...).
Un-comment line 164 and remove the newline, so it says:
While this is an old question, it's still relevant for other users (such as myself) who find it via Google, so I wanted to add this answer for Mac & Linux users.
您可以使用
--nosep
选项。例如C:\Python32\Scripts\ipython3.exe --nosep
You can use the
--nosep
option. e.g.C:\Python32\Scripts\ipython3.exe --nosep
我在 Windows 上工作,Alok 的摘录与我的
%USERPROFILE%/_ipython/ipythonrc.ini
中这三行的默认内容没有什么不同,我宁愿将行:更改
为:
I'm working on Windows, Alok's excerp didn't differ from the default content of these three lines in my
%USERPROFILE%/_ipython/ipythonrc.ini
I rather had to change the line:
to: