I am trying to convert Ruby code to my Python code. Initially, the developer is no longer with us, and I do not know Ruby. Most of its code is quite simple, but some of the following syntaxes disable me.
Example:
myTable = ''
myTable << [ 0, 1, 0, 0, 0, 300].pack('vvvvvv')
myTable [40, 4] = [41310005 - 5].pack('V')
1) Do I correctly assume that after the second line myTable will contain an array of 6 values specified in []? And what .pack()does Python look like struct.pack?
2) After the third line, the value on the right will be stored at position 40 in the array and should it be 4 bytes long? Is -5 in [] just that he has fun or has some special meaning?
source
share