is there a cleaner way to do this? I am interrogating a sensor on Ethernet, and I only need the first of the values given converted in a string or a number (the sensor is a counter).
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP_address,5400))
s.sendall(b'gcounters\x00')
L_IN = list(struct.unpack('4B',(s.recv(1024))))
L_OUT = list(struct.unpack('4B',(s.recv(1024))))
s.close()
## Deleting everything after the first value [x, 0, 0, 0]
del L_IN[1:4]
del L_OUT[1:4]
Can you help me to clean out the code please?