Пример #1
0
def smart_decode(s):
    if isinstance(s, unicode):
        return s
    elif isinstance(s, bytestr):
        # Should never reach this case in Python 3
        return unicode(s, 'utf-8')
    else:
        return unicode(s)
Пример #2
0
def smart_decode(s):
    if isinstance(s, unicode):
        return s
    elif isinstance(s, bytestr):
        # Should never reach this case in Python 3
        return unicode(s, "utf-8")
    else:
        return unicode(s)
Пример #3
0
def encode_bytearray(barray):
    if isbytestr(barray):
        return unicode().join((unichr(ord(by) << 8) for by in barray))
    else:
        return unicode().join((unichr(by << 8) for by in barray))
def get_list(count):
    return [unicode(i) for i in range(count)]
Пример #5
0
def get_list(count):
    return [unicode(i) for i in range(count)]
Пример #6
0
def encode_bytearray(barray):
    if isbytestr(barray):
        return unicode().join((unichr(ord(by) << 8) for by in barray))
    else:
        return unicode().join((unichr(by << 8) for by in barray))