This what I have to send 85, 170, 81,42,17,0,2,21,255,255,66,11,52,54,0,97,168.
I have tried using bytearray() but it will send bytearray(b'\x01\x02\x03'), and I only want 17 bytes to be sent.  
            Asked
            
        
        
            Active
            
        
            Viewed 34 times
        
    0
            
            
         
    
    
        B_PRIEUR
        
- 160
- 1
- 1
- 18
- 
                    You're looking for the [`struct`](https://docs.python.org/3/library/struct.html) module: `struct.pack('B' * len(lst), *lst)`. – Ashwini Chaudhary Jun 12 '17 at 07:08
- 
                    This is what i m getting: lst=[10,100,200] >>> f=struct.pack('B'*len(lst),*lst) >>> f '\nd\xc8' – user8147287 Jun 12 '17 at 08:39
