Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列: が与えられた場合、または?aa0a051c1400のみを抽出するにはどうすればよいですか? 私はシリアル応答を読んでおり、16 進データのフラグメントを調べて、この最初のデータ パケットの後にパイプを下って来るデータの量を解読する必要があります。051c
aa0a051c1400
05
1c
文字列をインデックスで解析するだけでうまくいきます。文字インデックスで解析する場合:
from binascii import hexlify, unhexlify def get_hex(stream, idx): return hexlify(unhexlify(stream)[idx]) get_hex('aa0a051c1400', 0) 'aa'