本文整理汇总了Python中textwrap.TextWrapper.break_long_words方法的典型用法代码示例。如果您正苦于以下问题:Python TextWrapper.break_long_words方法的具体用法?Python TextWrapper.break_long_words怎么用?Python TextWrapper.break_long_words使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类textwrap.TextWrapper
的用法示例。
在下文中一共展示了TextWrapper.break_long_words方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: linewrap
# 需要导入模块: from textwrap import TextWrapper [as 别名]
# 或者: from textwrap.TextWrapper import break_long_words [as 别名]
def linewrap(width = None):
"""Returns a function that wraps long lines to a max of 251 characters.
Note that this function returns a list of lines, which is suitable as the
argument for the spss.Submit function.
"""
wrapper = TextWrapper()
wrapper.width = width or 251
wrapper.replace_whitespace = True
wrapper.break_long_words = False
wrapper.break_on_hyphens = False
return wrapper.wrap
示例2: getMsg
# 需要导入模块: from textwrap import TextWrapper [as 别名]
# 或者: from textwrap.TextWrapper import break_long_words [as 别名]
def getMsg(self):
primary_authors = []
for auth in self._abstract.getPrimaryAuthorList():
primary_authors.append("""%s (%s) <%s>""" % (auth.getFullName(), auth.getAffiliation(), auth.getEmail()))
co_authors = []
for auth in self._abstract.getCoAuthorList():
email = ""
if auth.getEmail() != "":
email = " <%s>" % auth.getEmail()
co_authors.append("""%s (%s)%s""" % (auth.getFullName(), auth.getAffiliation(), email))
speakers = []
for spk in self._abstract.getSpeakerList():
speakers.append(spk.getFullName())
tracks = []
for track in self._abstract.getTrackListSorted():
tracks.append("""%s""" % track.getTitle())
tw = TextWrapper()
msg = [i18nformat("""_("Dear") %s,""") % self._abstract.getSubmitter().getStraightFullName()]
msg.append("")
msg.append(tw.fill(_("The submission of your abstract has been successfully processed.")))
msg.append("")
tw.break_long_words = False
msg.append(
tw.fill(i18nformat("""_("Abstract submitted"):\n<%s>.""") % urlHandlers.UHUserAbstracts.getURL(self._conf))
)
msg.append("")
msg.append(
tw.fill(
i18nformat("""_("Status of your abstract"):\n<%s>.""")
% urlHandlers.UHAbstractDisplay.getURL(self._abstract)
)
)
msg.append("")
tw.subsequent_indent = ""
msg.append(tw.fill(i18nformat("""_("See below a detailed summary of your submitted abstract"):""")))
msg.append("")
tw.subsequent_indent = " " * 3
msg.append(tw.fill(i18nformat("""_("Conference"): %s""") % self._conf.getTitle()))
msg.append("")
msg.append(tw.fill(i18nformat("""_("Submitted by"): %s""") % self._abstract.getSubmitter().getFullName()))
msg.append("")
msg.append(
tw.fill(
i18nformat("""_("Submitted on"): %s""") % self._abstract.getSubmissionDate().strftime("%d %B %Y %H:%M")
)
)
msg.append("")
msg.append(tw.fill(i18nformat("""_("Title"): %s""") % self._abstract.getTitle()))
msg.append("")
for f in self._conf.getAbstractMgr().getAbstractFieldsMgr().getFields():
msg.append(tw.fill(f.getCaption()))
msg.append(self._abstract.getField(f.getId()))
msg.append("")
msg.append(tw.fill(i18nformat("""_("Primary Authors"):""")))
msg += primary_authors
msg.append("")
msg.append(tw.fill(i18nformat("""_("Co-authors"):""")))
msg += co_authors
msg.append("")
msg.append(tw.fill(i18nformat("""_("Abstract presenters"):""")))
msg += speakers
msg.append("")
msg.append(tw.fill(i18nformat("""_("Track classification"):""")))
msg += tracks
msg.append("")
ctype = i18nformat("""--_("not specified")--""")
if self._abstract.getContribType() is not None:
ctype = self._abstract.getContribType().getName()
msg.append(tw.fill(i18nformat("""_("Presentation type"): %s""") % ctype))
msg.append("")
msg.append(tw.fill(i18nformat("""_("Comments"): %s""") % self._abstract.getComments()))
msg.append("")
return "\n".join(msg)