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


Python string.joinfields方法代码示例

本文整理汇总了Python中string.joinfields方法的典型用法代码示例。如果您正苦于以下问题:Python string.joinfields方法的具体用法?Python string.joinfields怎么用?Python string.joinfields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在string的用法示例。


在下文中一共展示了string.joinfields方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_mailstack

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def do_mailstack(self, arg):
        tolist = arg.split()
        subject = '[Conary Stacktrace]'
        if 'stack' in self.__dict__:
            # when we're saving we always 
            # start from the top
            frame = self.stack[-1][0]
        else:
            frame = sys._getframe(1)
            while frame.f_globals['__name__'] in ('epdb', 'pdb', 'bdb', 'cmd'):
                frame = frame.f_back
        sender = os.environ['USER']
        host = socket.getfqdn()
        extracontent = None
        if self._tb:
            lines = traceback.format_exception(self._exc_type, self._exc_msg, 
                                               self._tb)
            extracontent = string.joinfields(lines, "")
        epdb_stackutil.mailStack(frame, tolist, sender + '@' + host, subject,
                            extracontent)
        print "Mailed stack to %s" % tolist 
开发者ID:sassoftware,项目名称:conary,代码行数:23,代码来源:__init__.py

示例2: do_mailstack

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def do_mailstack(self, arg):
        tolist = arg.split()
        subject = '[Conary Stacktrace]'
        if 'stack' in self.__dict__:
            # when we're saving we always start from the top
            frame = self.stack[-1][0]
        else:
            frame = sys._getframe(1)
            while frame.f_globals['__name__'] in ('epdb', 'pdb', 'bdb', 'cmd'):
                frame = frame.f_back
        sender = os.environ['USER']
        host = socket.getfqdn()
        extracontent = None
        if self._tb:
            lines = traceback.format_exception(self._exc_type, self._exc_msg,
                                               self._tb)
            extracontent = string.joinfields(lines, "")
        epdb_stackutil.mailStack(frame, tolist, sender + '@' + host, subject,
                                 extracontent)
        print("Mailed stack to %s" % tolist) 
开发者ID:sassoftware,项目名称:epdb,代码行数:22,代码来源:__init__.py

示例3: __str__

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def __str__(self):
	"""Return a human-readable representation.
	
	>>> str(N['dog'][0].synset)
	'{noun: dog, domestic dog, Canis familiaris}'
	"""
	return "{" + self.pos + ": " + string.joinfields(map(lambda sense:sense.form, self.getSenses()), ", ") + "}" 
开发者ID:rafasashi,项目名称:razzy-spinner,代码行数:9,代码来源:wordnet.py

示例4: writelines

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def writelines(self, list):
        self.write(string.joinfields(list, '')) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:4,代码来源:dbrecio.py

示例5: text

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def text(self, xy, text):
        text = string.joinfields(string.splitfields(text, "("), "\\(")
        text = string.joinfields(string.splitfields(text, ")"), "\\)")
        xy = xy + (text,)
        self.fp.write("%d %d M (%s) S\n" % xy) 
开发者ID:awslabs,项目名称:mxnet-lambda,代码行数:7,代码来源:PSDraw.py

示例6: write_map

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def write_map(self, m):
    sc = StringCodec()
    if m is not None:
      sc.write_uint32(len(m))
      sc.write(string.joinfields(map(self._write_map_elem, m.keys(), m.values()), ""))
    self.write_vbin32(sc.encoded) 
开发者ID:apache,项目名称:qpid-python,代码行数:8,代码来源:codec010.py

示例7: normpath

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def normpath(path):
    """Normalize path, eliminating double slashes, etc."""
    sep = os.sep
    if sep == '\\':
        path = path.replace("/", sep)
    curdir = os.curdir
    pardir = os.pardir
    import string
    # Treat initial slashes specially
    slashes = ''
    while path[:1] == sep:
        slashes = slashes + sep
        path = path[1:]
    comps = string.splitfields(path, sep)
    i = 0
    while i < len(comps):
        if comps[i] == curdir:
            del comps[i]
            while i < len(comps) and comps[i] == '':
                del comps[i]
        elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir):
            del comps[i-1:i+1]
            i = i-1
        elif comps[i] == '' and i > 0 and comps[i-1] <> '':
            del comps[i]
        else:
            i = i+1
    # If the path is now empty, substitute '.'
    if not comps and not slashes:
        comps.append(curdir)
    return slashes + string.joinfields(comps, sep) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:33,代码来源:javapath.py

示例8: printTraceBack

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def printTraceBack(tb=None, output=sys.stderr, exc_type=None, exc_msg=None):
    if isinstance(output, str):
        output = open(output, 'w')

    exc_info = sys.exc_info()
    if tb is None:
        tb = exc_info[2]

    if exc_type is None:
        exc_type = exc_info[0]

    if exc_msg is None:
        exc_msg = exc_info[1]

    if exc_type is not None:
        output.write('Exception: ')
        exc_info = '\n'.join(traceback.format_exception_only(exc_type, exc_msg))
        output.write(exc_info)
        output.write('\n\n')

    lines = traceback.format_exception(exc_type, exc_msg, tb)
    output.write(string.joinfields(lines, ""))

    while tb:
        _printFrame(tb.tb_frame, output=output)
        tb = tb.tb_next 
开发者ID:sassoftware,项目名称:conary,代码行数:28,代码来源:epdb_stackutil.py

示例9: genExcepthook

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def genExcepthook(self):
    def excepthook(type, exc_msg, tb):
        cfg = self.recipe.cfg
        sys.excepthook = sys.__excepthook__
        if cfg.debugRecipeExceptions:
            lines = traceback.format_exception(type, exc_msg, tb)
            print string.joinfields(lines, "")
        if self.linenum is not None:
            prefix = "%s:%s:" % (self.file, self.linenum)
            prefix_len = len(prefix)
            if str(exc_msg)[:prefix_len] != prefix:
                exc_message = "%s:%s: %s: %s" % (self.file, self.linenum,
                                              type.__name__, exc_msg)
            print exc_message

        if self.recipe.buildinfo:
            try:
                buildinfo = self.recipe.buildinfo
                buildinfo.error = exc_message
                buildinfo.file = self.file
                buildinfo.lastline = self.linenum
                buildinfo.stop()
            except:
                log.warning("could not write out to buildinfo")

        if cfg.debugRecipeExceptions and self.recipe.isatty():
            debugger.post_mortem(tb, type, exc_msg)
        else:
            sys.exit(1)
    return excepthook 
开发者ID:sassoftware,项目名称:conary,代码行数:32,代码来源:action.py

示例10: printTraceBack

# 需要导入模块: import string [as 别名]
# 或者: from string import joinfields [as 别名]
def printTraceBack(tb=None, output=sys.stderr, exc_type=None, exc_msg=None):
    if isinstance(output, str):
        output = open(output, 'w')

    exc_info = sys.exc_info()
    if tb is None:
        tb = exc_info[2]

    if exc_type is None:
        exc_type = exc_info[0]

    if exc_msg is None:
        exc_msg = exc_info[1]

    if exc_type is not None:
        output.write('Exception: ')
        exc_info = '\n'.join(traceback.format_exception_only(
            exc_type, exc_msg))
        output.write(exc_info)
        output.write('\n\n')

    lines = traceback.format_exception(exc_type, exc_msg, tb)
    output.write(string.joinfields(lines, ""))

    while tb:
        _printFrame(tb.tb_frame, output=output)
        tb = tb.tb_next 
开发者ID:sassoftware,项目名称:epdb,代码行数:29,代码来源:epdb_stackutil.py


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