[英]How to get tqdm to print to the same line regardless of terminal window size?
[英]Print loop to the same line in terminal
這是一些代碼。 這應該是不言自明的。 但無論如何,我們走了。
try:
smtpserver.login(user, password)
print "password is: %s" % password
break;
except smtplib.SMTPAuthenticationError:
print "wrong: %s" % password
除了代替它打印行以外,所有作品都可以
wrong: pass
wrong: pass
wrong: pass
在找到密碼匹配之前,是否可以在同一行上打印?
在Python中,一個,
在print語句的結束,防止線路中斷,從而防止下一個文本在新行打印。 所以,
try:
smtpserver.login(user, password)
print "password is: %s" % password
break;
except smtplib.SMTPAuthenticationError:
print "wrong: %s" % password,
這將在同一行中打印所有文本,直到密碼正確為止
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.