In Java i did it like this but how do you do this in Python? Specially the bytesArray[i] = (byte) (Integer.parseInt(byteArrayStr[i],16));
public static byte[] toBytes(String bytes) throws IOException
{
String byteArrayStr[] = bytes.split("\\/");
byte bytesArray[] = new byte[byteArrayStr.length];
for (int i = 0; i < byteArrayStr.length; ++i)
{
bytesArray[i] = (byte) (Integer.parseInt(byteArrayStr[i],16));
}
return bytesArray;
}
To answer directly:
int(x, 16). What you’re doing in Python would be a single list comprehension (I’m assuming string looks likeaf/ce/13/...)