Java的getBytes():
byte[] a = "abc".getBytes();
for(int i : a){
System.out.print(i + " ");
}
Python表示方法:
def demo():
a = "abc"
b = bytearray(a.encode())
for i in range(len(b)):
print(b[i],end=" ")
输出都为:
97 98 99
Java的getBytes():
byte[] a = "abc".getBytes();
for(int i : a){
System.out.print(i + " ");
}
Python表示方法:
def demo():
a = "abc"
b = bytearray(a.encode())
for i in range(len(b)):
print(b[i],end=" ")
输出都为:
97 98 99
本文标题:Java的getBytes()对应python里面的bytear
本文链接:https://www.haomeiwen.com/subject/mjgwoctx.html
网友评论