在Python 2.7及更高版本(包括python3)中工作:
result = bytearray.fromhex('deadbeef')注意:bytearray.fromhex() Python
2.6中的函数似乎存在一个错误。python.org文档指出该函数接受字符串作为参数,但在应用时会引发以下错误:
>>> bytearray.fromhex('B9 01EF')Traceback (most recent call last): File "<stdin>", line 1, in <module>TypeError: fromhex() argument 1 must be unipre, not str`
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)