Back9 <backgoo...@gmail.com> writes: > Hi, > > I have one byte data and want to know each bit info, > I mean how I can know each bit is set or not?
Other than the tedious anding, oring and shifting, you can convert your byte to a string (with function bin) and use normal string handling functions to check if individual bits are 0 or 1. String format is also handy if you happen to need to do things like reversing the bit order or slicing and joining together various bits from different bytes. I seem to invariably need to do some bit order reversing when I mess around with serial data, which is one reason why I like Python. -- http://mail.python.org/mailman/listinfo/python-list