I'm brand new to Python (C is my main language), so this may be a super basic/naive question.
I have two lists of integers that I'm generating with the following Python code:
mainList = range(100)
random.shuffle(mainList)
list1 = mainList[:len(mainList)/2]
list2 = mainList[len(mainList)/2:]
Basically, I'm trying to send each of these lists (list1
and list2
) over a TCP connection, and I want to make sure that I'm only sending a 50-byte payload for each (each list contains 50 integers).
What would be the best way to do this? Would the bytearray()
function be applicable here, at all?