For example, I have two variables int1 = 5
and int2 = 3
How can I print both the integers in separate lines using only a single print
without typecasting to str
。 (如 C++ 中的以下内容: cout<<int1<<endl<<int2;
)
原文由 Fakru 发布,翻译遵循 CC BY-SA 4.0 许可协议
在 python3 中:
在蟒蛇2:
… 或
from __future__ import print_function
并使用 python3 的打印自从我的第一个回答以来,OP 已经通过变量类型更改编辑了问题。更新更新问题的答案:
如果你有一些整数,即
int1
和int2
:蟒蛇 3:
蟒蛇2:
或者
或者