当前位置: 首页>>代码示例>>Python>>正文


Python TextWrapper.break_long_words方法代码示例

本文整理汇总了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
开发者ID:matt-hayden,项目名称:python-utilities,代码行数:13,代码来源:spss_functions.py

示例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)
开发者ID:jbenito3,项目名称:indico,代码行数:75,代码来源:CFADisplay.py


注:本文中的textwrap.TextWrapper.break_long_words方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。