当我在最后包含一些东西时,Python换行符'\n'不起作用

jss*_*367 2 python line-breaks

当我在语句中包含某些东西时,Python linebreak命令\n在Python 2.7上不起作用,比如int或numpy数组.有没有办法做到这一点?这里有些例子:

print("These \n linebreaks don't work:\n", 1)
"These \n linebreaks don't work:\n", 1

print("These \n work fine\n")
These 
 work fine
Run Code Online (Sandbox Code Playgroud)

tim*_*geb 7

如果要print像函数一样使用,请从Python3导入一个.

>>> from __future__ import print_function
>>> print("These \n linebreaks don't work:\n", 1)
These 
 linebreaks don't work:
 1
Run Code Online (Sandbox Code Playgroud)

现在他们实际上做了,你不必改变任何东西.