python字符串str和字节数组相互转化
2015-01-29 15:17
423 查看
s="'2014/9/18 23:16:34'"
c = bytearray(str(s).encode("gbk"))
c = bytearray(str(s).encode("gbk"))
# bytes object b = b"example" # str object s = "example" # str to bytes bytes(s, encoding = "utf8") # bytes to str str(b, encoding = "utf-8") # an alternative method # str to bytes str.encode(s) # bytes to str bytes.decode(b)
相关文章推荐
- python字符串str和字节数组相互转化
- python字符串str和字节数组相互转化方法
- python字符串str和字节数组相互转化
- python基础---字符串类型str和字节类型bytes相互转化
- python中str(字符串)、list(列表)、tuple(元组)、dict(字典)相互转化关系及字典键-值遍历
- 字节数组byte[]与16进制字符串的相互转化
- python2.7下面字节数组(ByteArray)和16进制字符串(HexString)转化
- python 字符串编码 str和unicode 区别以及相互转化 decode('utf-8') encode('utf-8')
- 字符串、字节数组、可序列化对象之间的相互转化
- 字节数组和字符串的相互转化……
- php中字符串与数组的相互转化explode(separator,$str)与implode(separator,$arr)
- 字符串和整形数组的相互转化(JAVA程序)
- 字节数组和16进制表示的字符串互相转化
- python 字符串转化成数组
- 字符串和byte数组的相互转化
- js数组与字符串的相互转化
- js数组的操作及数组与字符串的相互转化
- Python中的列表,元组,字符串之间的相互转化
- javascript数组与字符串的相互转化
- 多字节字符串与宽字节字符串的相互转化