ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

If you write print() function in a program and someone using Python 2.x tries to run it, they will get an error. To avoid this, it is a good practice to import print function :

from __future__ import print_function

The from __future__ import print_function ; to bring the print function from Python 3 into Python 2.x. Now your code works on both Python 2.x and Python 3.x . The __future__ statements need to be near the top of the file because they change fundamental things about the language, and so the compiler needs to know about them from the beginning.