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


Groups > comp.lang.python > #75786 > unrolled thread

How to delete letters automatically with imaplib?

Started byelearn <elearn2014@gmail.com>
First post2014-08-06 17:02 +0800
Last post2014-08-06 17:02 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  How to delete letters automatically with imaplib? elearn <elearn2014@gmail.com> - 2014-08-06 17:02 +0800

#75786 — How to delete letters automatically with imaplib?

Fromelearn <elearn2014@gmail.com>
Date2014-08-06 17:02 +0800
SubjectHow to delete letters automatically with imaplib?
Message-ID<mailman.12693.1407315762.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

I have a gmail account 'xxx@gmail.com' which subscripted python 
maillist. To take part in python discussion is the only target for my 
xxx@gmail.com. There are so many emails in my xxx@gmail.com,it is a good 
idea for me to auto delete all emails whose body contain no . I write 
some codes to do the job.

|import  imaplib
user="xxx"
password="yyyyyy"
con=imaplib.IMAP4_SSL('imap.gmail.com')
con.login(user,password)
con.select('INBOX')
status,  data=  con.search(None,  "ALL")
print(len(data[0].split()))
48
typ,  data=  con.search(None,  'Body',  '"xxx@gmail.com"')
>>>  data
[b'1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  32 33 34 35 36 37 44']

len(data[0].split())
36|

How can i delete 48-36=12 letters?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web