receive string with chars

Posted by Meloun on Stack Overflow See other posts from Stack Overflow or by Meloun
Published on 2010-06-02T08:03:45Z Indexed on 2010/06/02 8:23 UTC
Read the original article Hit count: 238

Filed under:
|
|

Hi all, i am quite new in python.

I am receiving (through pyserial) string with data values. How can I parse these data to particular data structure?

I know that

 0-1 byte : id
 2-5 byte : time1 =>but little endian (lsb first)
 6-9 byte : time2 =>but little endian (lsb first)

and I looking for a function:

def parse_data(string):
  data={}
  data['id'] = ??
  data['time1'] = ??
  data['time2'] = ??
  return data

thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about parse