I am trying to convert an array of strings oldlist = ['00000100', '10100001', '11000001', '11100001'] that are binary values into bytes of their value as hex codes so the resulting list would look like this newlist = [b'\x04', b'\xa1', b'\xc1', b'\xe1']. I get the basic concept of looping through the first list and appended to the previous or doing some sort of list comp. But I can't find a function to convert "00000100" to " b'\x04' "