国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

python函數-bytearray

來源:懂視網 責編:小采 時間:2020-11-27 14:28:39
文檔

python函數-bytearray

python函數-bytearray:bytearray([source [, encoding [, errors]]])中文說明:bytearray([source [, encoding [, errors]]])返回一個byte數組。Bytearray類型是一個可變的序列,并且序列中的元素的取值范圍為 [0 ,255]。參數source:如果source為整數,則返
推薦度:
導讀python函數-bytearray:bytearray([source [, encoding [, errors]]])中文說明:bytearray([source [, encoding [, errors]]])返回一個byte數組。Bytearray類型是一個可變的序列,并且序列中的元素的取值范圍為 [0 ,255]。參數source:如果source為整數,則返

bytearray([source [, encoding [, errors]]])

中文說明:

bytearray([source [, encoding [, errors]]])返回一個byte數組。Bytearray類型是一個可變的序列,并且序列中的元素的取值范圍為 [0 ,255]。

參數source:

如果source為整數,則返回一個長度為source的初始化數組;

如果source為字符串,則按照指定的encoding將字符串轉換為字節序列;

如果source為可迭代類型,則元素必須為[0 ,255]中的整數;

如果source為與buffer接口一致的對象,則此對象也可以被用于初始化bytearray.。

版本:在python2.6后新引入,在python3中同樣可以使用!

英文說明:

Return a new array of bytes. The bytearray type is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the str type has, see String Methods.

The optional source parameter can be used to initialize the array in a few different ways:

If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode().

If it is an integer, the array will have that size and will be initialized with null bytes.

If it is an object conforming to the buffer interface, a read-only buffer of the object will be used to initialize the bytes array.

If it is an iterable, it must be an iterable of integers in the range 0 <= x < 256, which are used as the initial contents of the array.

Without an argument, an array of size 0 is created.

New in version 2.6.

實例演示:

>>> a = bytearray(3)
>>> a
bytearray(b'x00x00x00')
>>> a[0]
 
>>> a[1]
 
>>> a[2]
 
>>> b = bytearray("abc")
>>> b
bytearray(b'abc')
>>> b[0]
 
>>> b[1]
 
>>> b[2]
 
>>> c = bytearray([1, 2, 3])
>>> c
bytearray(b'x01x02x03')
>>> c[0]
 
>>> c[1]
 
>>> c[2]
 
>>> d = bytearray(buffer("abc"))
>>> d
bytearray(b'abc')
>>> d[0]
 
>>> d[1]
 
>>> d[2]

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

python函數-bytearray

python函數-bytearray:bytearray([source [, encoding [, errors]]])中文說明:bytearray([source [, encoding [, errors]]])返回一個byte數組。Bytearray類型是一個可變的序列,并且序列中的元素的取值范圍為 [0 ,255]。參數source:如果source為整數,則返
推薦度:
標簽: 函數 python byte
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 国产一区亚洲欧美成人 | 中文在线第一页 | 91久久精品一区二区三区 | 中文字幕第4页 | 久久91精品国产91 | 精品国产免费一区二区三区五区 | 久久久精品一区二区三区 | 国产伦精品一区二区三区 | 国产精品久久久久久久免费 | 伊人久久精品成人网 | 97一级毛片全部免费播放 | 久久精品国产亚洲a不卡 | www日韩 | 日韩欧美一区二区三区在线播放 | 欧美日韩国产在线观看 | 日本中文字幕有码 | 日韩欧美一卡二区 | 香蕉视频在线观看网站 | 黄色一级视频免费看 | 国产va免费精品观看 | 国产毛片一区二区三区精品 | 亚洲爱爱网站 | 国产中文久久精品 | 欧美在线看欧美视频免费网站 | 亚洲欧美另类自拍 | 久久综合中文字幕一区二区 | 国产精在线 | 久久精品国产亚洲a不卡 | 国产精品一区久久 | 国产精品一区二区综合 | 日韩欧美色 | 啪啪网免费 | 国产日韩欧美综合在线 | 亚洲欧美日韩综合网导航 | 一区二区免费在线观看 | 国产成人综合久久精品尤物 | 日韩在线第三页 | 欧美色图日韩 | 国产黄色小视频在线观看 | 欧美精品v国产精品v日韩精品 | 欧美色图日韩 |