本文整理匯總了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
""")