I think it is important question and it is not answered yet (the OP seems to already know about shift operators). Let me try to answer, the >> operator in your example is used for two different purposes. In c++ terms this operator is overloaded. In the first example it is used as bitwise operator (left shift), while in the second scenario it is merely used as output redirection. i.e.
2 << 5 # shift to left by 5 bits
2 >> 5 # shift to right by 5 bits
print >> obj, "Hello world" # redirect the output to obj,
example
with open('foo.txt', 'w') as obj:
print >> obj, "Hello world" # hello world now saved in foo.txt
update:
In python 3 it is possible to give the file argument directly as follows:
print("Hello world", file=open("foo.txt", "a")) # hello world now saved in foo.txt
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…