Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何削减预算?_Python_Arrays_List_Byte - Fatal编程技术网

Python 如何削减预算?

Python 如何削减预算?,python,arrays,list,byte,Python,Arrays,List,Byte,我有一个bytearray,当我列出数组时,我会得到以下数据:(b'v10\xc73\x9a&\x9edv\x19\xc3B\xbf\x95\xc8\xd8\x9dN\x8f\xe9\x90J\xax>r1\x1d\xa7\x1fU\x90\XE2(| p\XF1\x02\xbdw\XB8\xb9\xf3\xb2n\xc7')) 我需要解密这些数据。但是解密函数只接收数据,例如,b'v10\xc73\x9a&\x9edv\x19\xc3B\xbf\x95\xc8\xd8\x9dN\x8f\xe9

我有一个bytearray,当我列出数组时,我会得到以下数据:
(b'v10\xc73\x9a&\x9edv\x19\xc3B\xbf\x95\xc8\xd8\x9dN\x8f\xe9\x90J\xax>r1\x1d\xa7\x1fU\x90\XE2(| p\XF1\x02\xbdw\XB8\xb9\xf3\xb2n\xc7'))

我需要解密这些数据。但是解密函数只接收数据,例如,
b'v10\xc73\x9a&\x9edv\x19\xc3B\xbf\x95\xc8\xd8\x9dN\x8f\xe9\x90J\xax>r1\x1d\xa7\x1fU\x90\xe2(| p\xf1\x02\xbdw\xb8\xb9\xf3\x0e\xb2n\xc7')
()

我能做什么?

如果我们有

data = (b'foo',)
那么,这个
数据
不是字节数组,也不是
字节
对象:

>>> type(data)
<class 'tuple'>
>类型(数据)
因为它是一个元组,我们可以提取该元素:

>>> data[0]
b'foo'
>>> type(data[0])
<class 'bytes'>
>数据[0]
b'foo'
>>>类型(数据[0])
不是bytearray的一部分。它们表明您不仅仅拥有bytearray,而是一个包含一个bytearray的元组。