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]:
有人知道这种行为的原因吗?