Reputation: 15
Here is some code. it should be self explanatory. but anyways here we go.
try:
smtpserver.login(user, password)
print "password is: %s" % password
break;
except smtplib.SMTPAuthenticationError:
print "wrong: %s" % password
All works fie except instead of it printing lines like
wrong: pass
wrong: pass
wrong: pass
Is it possible to print on the same line until a password match is found?
Upvotes: 0
Views: 160
Reputation: 11070
In python, a ,
at the end of print statement, prevents a line break, thus preventing the next text from printing in new line. So,
try:
smtpserver.login(user, password)
print "password is: %s" % password
break;
except smtplib.SMTPAuthenticationError:
print "wrong: %s" % password,
This will print all text in same line, until the password is right
Upvotes: 3