0

I don't have much knowledge of python. I have a code written in python which I am trying to compile. Its giving me following error

 File "parseBvh.py", line 382
    print(T[0],T[1],T[2],file=fp)
                             ^
SyntaxError: invalid syntax

I tried to find out the correct syntax but am not able to. Can someone point me in right direction?

2
  • 2
    No need to assign anything: print(T[0],T[1],T[2],fp) Commented Jan 20, 2015 at 6:26
  • possible duplicate of Syntax error on print with Python 3 Commented Jan 20, 2015 at 6:30

1 Answer 1

1

In Python 2, print is a statement, not a function:

print >> fp, T[0],T[1],T[2]

or (probably better):

fp.write(" ".join(T[:3]) + "\n") # [:3] may be dropped if T only has 3 items
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.