W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
Python3 bytes 函數(shù)返回一個(gè)新的 bytes 對象,該對象是一個(gè) 0 <= x < 256 區(qū)間內(nèi)的整數(shù)不可變序列。它是 bytearray 的不可變版本。
以下是 bytes 的語法:
class bytes([source[, encoding[, errors]]])
返回一個(gè)新的 bytes 對象。
以下展示了使用 bytes 的實(shí)例:
>>>a = bytes([1,2,3,4])
>>> a
b'\x01\x02\x03\x04'
>>> type(a)
<class 'bytes'>
>>>
>>> a = bytes('hello','ascii')
>>>
>>> a
b'hello'
>>> type(a)
<class 'bytes'>
>>>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: