简体   繁体   English

两条 output 分割线 python

[英]Two output split lines python

I want to run a true while loop in first line of output with end=' ' just like this print(' ',end=' ') # this will print ' ' in first line of output for ever我想在 output 的第一行运行一个真正的 while 循环,其中 end='' 就像这个 print(' ',end='') # 这将永远在 output 的第一行打印' '

and so I want to run this as same as previous line but at second line of my output所以我想像上一行一样运行它,但在我的 output 的第二行

like this像这样

// this will run and show at first line // 这将运行并显示在第一行

while True :
   print('*',end=' ')  

// this will run and show at second line // 这将运行并显示在第二行

while True :
   print('$',end=' ')

*****************************... *****************************...

$$$$$$$$$$$$$$$$$$$$$$$... $$$$$$$$$$$$$$$$$$$$$$$$$...

for instance例如

write a program that " print '*' every 3s in first line of output and print '$' every 5s in second line of output " (at the same time)编写一个程序,“在 output 的第一行每 3 秒打印一次'*',在 output 的第二行每 5 秒打印一次'$'”(同时)

How can i do this?我怎样才能做到这一点?

use ``` to mark the beginning/end of your code snippets so it's actually readable.使用 ``` 来标记你的代码片段的开始/结束,所以它实际上是可读的。

As the comments mentioned, use \n for a new line anywhere.正如评论所提到的,在任何地方使用\n换行。 Omitting the end='' parameter will put a new line by default.省略 end='' 参数将默认放置一个新行。 Otherwise you can just do an empty print() to insert a newline character between your two loops, which does the same as print("\n", end='')否则,您可以只做一个空print()在两个循环之间插入换行符,这与print("\n", end='')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM