array x contains string followed by all zeros. I need expand the string but keep x array's size the same.
e.g.:
def modify(x,y):
return x
# input x and y
x = bytes([0x41,0x42,0x43,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00])
y = 'EFGH'
print(x)
x = modify(x,y)
#output x
print(x)
expected output:
b'ABCD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
b'ABCDEFGH\x00\x00\x00\x00\x00\x00\x00\x00'
What's propery way to do it in python3?