On Tuesday, 15 March 2016 22:32:42 UTC+5:30, Rick Johnson wrote: > Is that last line doing what you think it's doing? Let's > break it down... Basically you have one condition, that is > composed of two main components: > > Component-1: EMAIL in str(msg[header]) > > and > > Component-2: str(msg[header]) > > > "Component-1" will return a Boolean. So in essence you're > asking: > > boolean = EMAIL in str(msg[header]) > if boolean in str(msg[header]): > do_something() > > Is that really what you wanted to do? I'm not sure how you > will ever find a Boolean in a string. Unless i've missed > something...?
Yes I am looking for in EMAIL string is present in str(msg[header]) then do_something() >It will also help readability if you only > applied str() to the value *ONCE*. But, maybe you don't > even need the str() function??? I also run without str() but sometimes it causes weird exception errors because you can't predict the behaviour msg[header]. -- https://mail.python.org/mailman/listinfo/python-list