Python string 模块,joinfields() 实例源码

我们从Python开源项目中,提取了以下22个代码示例,用于说明如何使用string.joinfields()

项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def sendportcmd(s, f, port):
    hostname = gethostname()
    hostaddr = gethostbyname(hostname)
    hbytes = string.splitfields(hostaddr, '.')
    pbytes = [repr(port//256), repr(port%256)]
    bytes = hbytes + pbytes
    cmd = 'PORT ' + string.joinfields(bytes, ',')
    s.send(cmd + '\r\n')
    code = getreply(f)


# Process an ftp reply and return the 3-digit reply code (as a string).
# The reply should be a line of text starting with a 3-digit number.
# If the 4th char is '-', it is a multi-line reply and is
# terminate by a line starting with the same 3-digit number.
# Any text while receiving the reply is echoed to the file.
#
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def writelines(self, list):
        self.write(string.joinfields(list, ''))
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def writelines(self, list):
        self.write(string.joinfields(list, ''))
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def writelines(self, list):
        self.write(string.joinfields(list, ''))
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def flush(self):
        print 'flush: %d blocks, %d bytes' % (len(self._buffer), self._filled)
        if self._buffer:
            import string
            self._base.writeframes(string.joinfields(self._buffer, ''))
            self._buffer = []
            self._filled = 0
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def writelines(self, list):
        self.write(string.joinfields(list, ''))
项目:AmqpCode    作者:SVADemoAPP    | 项目源码 | 文件源码
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)
项目:qpid-python    作者:apache    | 项目源码 | 文件源码
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)
项目:CNCGToolKit    作者:cineuse    | 项目源码 | 文件源码
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)
项目:rensapy    作者:RensaProject    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:rensapy    作者:RensaProject    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:ZServer    作者:zopefoundation    | 项目源码 | 文件源码
def writelines(self, lines):
        self.data = self.data + string.joinfields(
            lines,
            '\r\n'
        ) + '\r\n'
项目:ZServer    作者:zopefoundation    | 项目源码 | 文件源码
def more(self):
        if not self.file_list:
            return ''
        else:
                # do a few at a time
            bunch = self.file_list[:50]
            if self.long:
                bunch = map(self.longify, bunch)
            self.file_list = self.file_list[50:]
            return string.joinfields(bunch, '\r\n') + '\r\n'
项目:ZServer    作者:zopefoundation    | 项目源码 | 文件源码
def writelines(self, lines):
        self.write(
            string.joinfields(
                lines,
                '\r\n'
            ) + '\r\n'
        )
项目:ZServer    作者:zopefoundation    | 项目源码 | 文件源码
def hex_digest(s):
    m = md5()
    m.update(s)
    return string.joinfields(
        map(lambda x: hex(ord(x))[2:], map(None, m.digest())),
        '',
    )
项目:ZServer    作者:zopefoundation    | 项目源码 | 文件源码
def writelines(self, lines):
        self.data = self.data + string.joinfields(
            lines,
            '\r\n'
        ) + '\r\n'
        self.check_data()
项目:RePhraser    作者:MissLummie    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:RePhraser    作者:MissLummie    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:InstagramPosting    作者:LeviParadis    | 项目源码 | 文件源码
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)
项目:Verideals    作者:Derrreks    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:Verideals    作者:Derrreks    | 项目源码 | 文件源码
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()), ", ") + "}"
项目:ngx_status    作者:YoYoAdorkable    | 项目源码 | 文件源码
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)