python - How to read complete file with bitstring -


i want read many 24 bit chunks possible file. how can using bitstrings' constbitstream when don't how many chunks there are?

currently this:

eventlist = constbitstream(filename = 'events.dat') in range(1000) :     packet = eventlist.read(24) 

(here have calculate number of events beforehand)

you read until readerror exeption generated

try:     while true:         packet = eventlist.read(24) except readerror:     pass 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -