1# utf-8 is used here because it is a very common encoding, but you
2# need to use the encoding your data is actually in.
3bytes = b'abcde'
4bytes.decode("utf-8")
5'abcde'
1
2byte[] byteArray1 = { 80, 65, 78, 75, 65, 74 };
3String str = new String(byteArray1, 0, 3, StandardCharsets.UTF_8);
4
1bytesliteral ::= bytesprefix(shortbytes | longbytes)
2bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR"
3shortbytes ::= "'" shortbytesitem* "'" | '"' shortbytesitem* '"'
4longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""'
5shortbytesitem ::= shortbyteschar | bytesescapeseq
6longbytesitem ::= longbyteschar | bytesescapeseq
7shortbyteschar ::= <any ASCII character except "\" or newline or the quote>
8longbyteschar ::= <any ASCII character except "\">
9bytesescapeseq ::= "\" <any ASCII character>
10