perhaps more than you want to make just your print operations version-neutral related tool named to attempts to do the inverseconvert code to run on xsee appendix for more information importing from __future__ alternativelyyou can code print function calls in code to be run by xby enabling the function call variant with statement like the following coded at the top of scriptor anywhere in an interactive sessionfrom __future__ import print_function this statement changes to support ' print functions exactly this wayyou can use print features and won' have to change your prints if you later migrate to two usage notes herethis statement is simply ignored if it appears in code run by --it doesn' hurt if included in code for compatibility this statement must appear at the top of each file that prints in --because it modifies that parser for single file onlyit' not enough to import another file that includes this statement neutralizing display differences with code also keep in mind that simple printslike those in the first row of table - work in either version of python--because any expression may be enclosed in parentheseswe can always pretend to be calling print function in by adding outer parentheses the main downside to this is that it makes tuple out of your printed objects if there are more than oneor none--they will print with extra enclosing parentheses in xfor exampleany number of objects may be listed in the call' parenthesesc:\codec:\python \python print('spam'spam print('spam''ham''eggs'spam ham eggs print function call syntax these are multiple arguments the first of these works the same in xbut the second generates tuple in the outputc:\codec:\python \python print('spam'spam print('spam''ham''eggs'('spam''ham''eggs' print statementenclosing parens this is really tuple objectthe same applies when there are no objects printed to force line-feed shows tupleunless you print an empty stringc:\codepy - >print(this is just line-feed on print operations