Mind Chasers Inc.
Mind Chasers Inc.

Note: Forum is in alpha testing. Please email us with any problems or issues you encounter. Thank you!

How do I concatenate binary data using Python3

Oct 07, 2020 asked by anonymous
share
subscribe to mailing list:

Question / Issue:

I want to take two variables that hold binary data and cat them together. For example, var1=0x0102 and var2=0x0304. How can I create a binary representation algorithmically using Python3?

Responses:

Date: Oct. 7, 2020

Author: Mind Chasers

Comment:

>>> var1=b'\x01\x02' >>> var2=b'\x03\x04' >>> var1+var2 b'\x01\x02\x03\x04' >>> (var1+var2).hex() '01020304'

Post your answer or comment:

your email address will be kept private
authenticate with a 3rd party for enhanced features, such as image upload
previous month
next month
Su
Mo
Tu
Wd
Th
Fr
Sa
loading