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)
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)
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)]