Possible Duplicate:
Tips on upgrading to python 3.0?
I am beginning Python and Python 3 is hardly a choice today. But I want the new code I write to have no problems running or being converted to Python 3. Are there any issues known that I should keep in mind for this?
The full correct answer is in the comments, of course - but if you only do one thing to prepare for Python 3, make it learning to use parentheses with 'print'.
Python 2.x:
print 'Hello, World!'
Python 3.x:
print('Hello, World!')
It's the number one most common error in my code when I try to write Python 3.
(And since both methods work with 2.x, you might as well go ahead and get used to using the parens!)
精彩评论