本文整理汇总了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