Reputation: 35
for method,proprties,body in message:
logger.info(proprties)
logger.info(method)
logger.info(body)
self.channel.basic_ack(proprties.timestamp)
k=proprties.timestamp
logger.info(k)
#k = 1463761209429
#k = 1463761194158
#k = 1463756480546
I want to come out of this for loop if k contains 1463761209, I don't care about the last three digits just match me the first 10 digit and come out.
# Escape out of the loop
if k == ??:
break
I want to write a if condition to break out of loop
Upvotes: 1
Views: 2605
Reputation: 560
You can try converting k to a string and check sub string using in
operator.
#for-loop
if '1463761209' in str(k):
break
That is only if performance is not a big issue!
Upvotes: 1