本文整理汇总了Python中email.Iterators.typed_subpart_iterator方法的典型用法代码示例。如果您正苦于以下问题:Python Iterators.typed_subpart_iterator方法的具体用法?Python Iterators.typed_subpart_iterator怎么用?Python Iterators.typed_subpart_iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email.Iterators
的用法示例。
在下文中一共展示了Iterators.typed_subpart_iterator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_typed_subpart_iterator
# 需要导入模块: from email import Iterators [as 别名]
# 或者: from email.Iterators import typed_subpart_iterator [as 别名]
def test_typed_subpart_iterator(self):
eq = self.assertEqual
msg = self._msgobj('msg_04.txt')
it = Iterators.typed_subpart_iterator(msg, 'text')
lines = []
subparts = 0
for subpart in it:
subparts += 1
lines.append(subpart.get_payload())
eq(subparts, 2)
eq(EMPTYSTRING.join(lines), """\
a simple kind of mirror
to reflect upon our own
a simple kind of mirror
to reflect upon our own
""")
示例2: test_typed_subpart_iterator_default_type
# 需要导入模块: from email import Iterators [as 别名]
# 或者: from email.Iterators import typed_subpart_iterator [as 别名]
def test_typed_subpart_iterator_default_type(self):
eq = self.assertEqual
msg = self._msgobj('msg_03.txt')
it = Iterators.typed_subpart_iterator(msg, 'text', 'plain')
lines = []
subparts = 0
for subpart in it:
subparts += 1
lines.append(subpart.get_payload())
eq(subparts, 1)
eq(EMPTYSTRING.join(lines), """\
Hi,
Do you like this message?
-Me
""")