byte_array = QByteArray()
string = "Hello world!" byte_array = QByteArray(string.encode('utf-8'))
byte_array = QByteArray(bytearray(b'\x48\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\x21'))
byte_array = QByteArray(b'hello') byte_array.append(b'world')The package library for PyQt5.QtCore.QByteArray is the PyQt5 package, which is a set of Python bindings for the Qt application framework and runs on all platforms supported by Qt including Windows, OS X, Linux, iOS, and Android.