On 30Sep2017 07:35, Chris <chris2...@postbox.xyz> wrote:
On Sat, 30 Sep 2017 00:23:45 +0100
Alan Gauld via Tutor <tutor@python.org> wrote:
If you really need it in memory there are some generic modules
for building tree structures in memory - you will need to
define the mail objects of course the modules are data neutral,
they just allow you to create and navigate the tree, populating
it with whatever objects you want.
Ok, can you recommend some specific?
Maybe not, but for your needs wouldn't nested dicts do the trick? Or nested
objects?
class MaildirInfo(object):
def __init__(self, path):
self.path = path
self.subdirs = [] # array of more Maildirinfo instances
self.other stuff here as needed ...
top = MaildirInfo("top-maildir-path")
then do the os.walk thing and fill out the data structure.
.subdirs could also be a dict mapping named to MaildirInfo instance, depending
on your needs.
Rather than Alan's take that nobody would want to do this, as someone who has
spent much time mucking with my mail tree using many scripts I'd say: everyone
wants to do something different. The task itself is fairly simple, so roll your
own. That makes is easy to implement your own policy instead of trying to do
some kind of feature survey of stuff out there.
Cheers,
Cameron Simpson <c...@cskk.id.au> (formerly c...@zip.com.au)
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor