Guest User

Untitled

a guest
Nov 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. list = [0x1, 0x2, 0x3, 0x4, 0x5, 0x6]
  2.  
  3. def chunks(l, n):
  4. "Yield successive n-sized chunks from l."""
  5. for i in range(0, len(l), n):
  6. yield l[i:i + n]
  7.  
  8. for c in chunks(list, 2):
  9. print c
  10. b = (c[0] << 8) + c[1]
  11. print hex(b)
Add Comment
Please, Sign In to add comment