Python Forum

Full Version: SyntaxError
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
Would someone be able to identify my syntax error please?
Error:
print ( >> fdeg , "%.8f %.8f %.5f" % (xx[ii], yy[jj], deformation[jj, ii])) ^ SyntaxError: invalid syntax
Without using the python tags, I'm not sure I can tell where the error is pointing at. But I'm wondering what you are intending with the >> fdeg. What are the arrows supposed to indicate?
I'm sorry I don't know as I'm trying to debug someone else's script. The chevron was under the gap before the >>.
Those arrows are not valid Python.
bolowfred Wrote:Those arrows are not valid Python.
The arrows were valid python in the Python 2 version of the print statement
print>>fileptr, "spam"
They are no longer valid in Python 3. The Python 3 version is
print("spam", file=fileptr)