Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. with open("bin-file", "rb") as f:
  2. for line in f:
  3. # Here I deal with every line
  4.  
  5. import struct
  6. unpack_str = '=?iiiiiiii...' # The actual string contains 739 i's
  7. n_bytes = 2957 # There are 2957 bytes per line
  8.  
  9. with open("bin-file", "rb") as f:
  10. line_bin = f.read(n_bytes)
  11. line_str = struct.unpack(unpack_str,line_bin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement