Why does the following statement
print >> textfile, 'this is redirected output'
(where textfile = open('text.dat', 'a'))
work for redirecting standard output to a file in Python 2.7, but doesn't work in Python 3.0 ?
The error message I get is:
Traceback (most recent call last):
File "C:\Users\HP\workspace\py\pypkg\redirection.py", line 19, in <module>
print >> (textfile, 'this is redirected output')
TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 'tuple'