gpt4 book ai didi

python - PyCharm 中 IPython 的奇怪 'print' 行为

转载 作者:行者123 更新时间:2023-12-05 03:24:50 25 4
gpt4 key购买 nike

<分区>

print 函数似乎减少了显示时的点数:

Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.22.0
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux

In [2]: s = "A\n..... a\n..... b\n"

In [3]: print(s)
A
.. a
.. b


In [4]:

在终端中不会发生这样的事情:

Python 3.8.10 (default, Mar 15 2022, 12:22:08) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> s = "A\n..... a\n..... b\n"
>>> print(s)
A
..... a
..... b
>>>

即使我在其中运行 IPython:

$ ipython

Python 3.8.10 (default, Mar 15 2022, 12:22:08)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: s = "A\n..... a\n..... b\n"

In [2]: print(s)
A
..... a
..... b


In [3]:

有人知道这种行为的原因吗?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com