PyDocs

Nav

Internet Data Handling

Mailbox

mailbox

class (source)
  • Mailbox(path, factory=None, create=True)
A group of messages in a particular place.
Changed in 3.15
  • 3.15: Support for the with statement was added.
Members of Mailbox

_

__contains__
Return True if the keyed message exists, False otherwise.
__delitem__
Delete the message corresponding to key from the mailbox.
__getitem__
Return the keyed message; raise KeyError if it doesn't exist.
__iter__
Return an iterator over representations of all messages.
__len__
Return a count of messages in the mailbox.
__setitem__
Replace the keyed message; raise KeyError if it doesn't exist.

a

add
Add message and return assigned key.

c

clear
Delete all messages.
close
Flush and close the mailbox.

d

discard
If the keyed message exists, remove it.

f

flush
Write any pending changes to the disk.

g

get
Return the keyed message, or default if it doesn't exist.
get_bytes
Return a byte string representation or raise a KeyError.
get_file
Return a file-like representation or raise a KeyError.
get_message
Return a Message representation or raise a KeyError.
get_string
Return a string representation or raise a KeyError.

i

items
Return a list of (key, message) tuples.
iteritems
Return an iterator over (key, message) tuples.
iterkeys
Return an iterator over keys.
itervalues
Return an iterator over all messages.

k

keys
Return a list of keys.

l

lock
Lock the mailbox.

p

pop
Delete the keyed message and return it, or default.
popitem
Delete an arbitrary (key, message) pair and return it.

r

remove
Remove the keyed message; raise KeyError if it doesn't exist.

u

unlock
Unlock the mailbox if it is locked.
update
Change the messages that correspond to certain keys.

v

values
Return a list of messages.
0 Examples
No examples for mailbox/Mailbox.
See Also
No see-alsos for mailbox/Mailbox
0 Notes
No notes for Mailbox