On Thursday, March 17, 2016 at 11:14:48 PM UTC-5, Arshpreet Singh wrote: > Yes I am looking for in EMAIL string is present in > str(msg[header]) then do_something() > > I also run without str() but sometimes it causes weird > exception errors because you can't predict the behavior > msg[header].
My suggestion is that you start over, you have too many issues here. (1) Your importing a module from within a function, that's almost always a bad idea. (2) You spelling your local variable names like constants, i wouldn't do that. (3) You're repeating yourself too much. (4) You're logic is invalid, and appears to possibly have syntax errors. Start from the beginning, and slowly add code "line-by- line", checking for proper outputs along the way. # # BEGIN CODE # import imaplib def inbox_week(): emailAddress = '...@gmail.com' emailPassword = 'mypassword' # START ADDING CODE HERE # # END CODE # -- https://mail.python.org/mailman/listinfo/python-list