Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105175

Re: Fetch Gmail Archieved messages

Newsgroups comp.lang.python
Date 2016-03-17 21:14 -0700
References <2f0a6e59-a636-4c65-9181-df6de05035a6@googlegroups.com> <29c50bd3-9bdf-444f-891f-9d9d3e314eea@googlegroups.com>
Message-ID <85665d75-a26b-470b-a5fd-5e647898319c@googlegroups.com> (permalink)
Subject Re: Fetch Gmail Archieved messages
From Arshpreet Singh <arsh840@gmail.com>

Show all headers | View raw


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].

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Fetch Gmail Archieved messages Arshpreet Singh <arsh840@gmail.com> - 2016-03-15 03:48 -0700
  Re: Fetch Gmail Archieved messages Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-15 10:02 -0700
    Re: Fetch Gmail Archieved messages Arshpreet Singh <arsh840@gmail.com> - 2016-03-17 21:14 -0700
      Re: Fetch Gmail Archieved messages Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-17 22:44 -0700
        Re: Fetch Gmail Archieved messages Arshpreet Singh <arsh840@gmail.com> - 2016-03-18 07:19 -0700
          Re: Fetch Gmail Archieved messages Rick Johnson <rantingrickjohnson@gmail.com> - 2016-03-18 17:08 -0700
            Re: Fetch Gmail Archieved messages Arshpreet Singh <arsh840@gmail.com> - 2016-03-20 12:56 -0700
              Re: Fetch Gmail Archieved messages Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-20 23:06 +0000

csiph-web