當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。