本文整理匯總了Python中multifile.MultiFile方法的典型用法代碼示例。如果您正苦於以下問題:Python multifile.MultiFile方法的具體用法?Python multifile.MultiFile怎麽用?Python multifile.MultiFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類multifile
的用法示例。
在下文中一共展示了multifile.MultiFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getbodyparts
# 需要導入模塊: import multifile [as 別名]
# 或者: from multifile import MultiFile [as 別名]
def getbodyparts(self):
"""Only for multipart messages: return the message's body as a
list of SubMessage objects. Each submessage object behaves
(almost) as a Message object."""
if self.getmaintype() != 'multipart':
raise Error, 'Content-Type is not multipart/*'
bdry = self.getparam('boundary')
if not bdry:
raise Error, 'multipart/* without boundary param'
self.fp.seek(self.startofbody)
mf = multifile.MultiFile(self.fp)
mf.push(bdry)
parts = []
while mf.next():
n = "%s.%r" % (self.number, 1 + len(parts))
part = SubMessage(self.folder, n, mf)
parts.append(part)
mf.pop()
return parts
示例2: test_main
# 需要導入模塊: import multifile [as 別名]
# 或者: from multifile import MultiFile [as 別名]
def test_main():
global boundaries, linecount
boundaries = 0
linecount = 0
f = cStringIO.StringIO(msg)
getMIMEMsg(multifile.MultiFile(f))
assert boundaries == 2
assert linecount == 9