Possible Duplicate:
Python - '>>' operator
What does the >> operator means in Python? ie:
x = x + str(n%2)
n >> 1
Thank you
Possible Duplicate:
Python - '>>' operator
What does the >> operator means in Python? ie:
x = x + str(n%2)
n >> 1
Thank you
n >> 1 shifts n right 1 bit. This is the same as dividing by 2.
More generally, n >> m shifts n right m bits, giving a division by 2^m.
Just for completeness, note that there's a completely different usage which is changing the stream that print uses by default:
print >> sys.stderr, message
For more information, please have a look at this related question.
python operatorsand clicking on the first hit.