Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种方法可以在程序中打印多个空白行,而无需键入
print("\n")
加载次数?
例如,我想在下一行文本之前有一个空白页(我认为大约 40 行)
只需使用乘法,这将重复你的字符串,无论你想要多少次,在这种情况下是新行
>>> print('\n' * 40)
您想在程序中使用简单的代码打印一条黑线,这里有一些示例:
print('\n') print("欢迎使用 python")
输出:
欢迎来到蟒蛇