Comment 18 for bug 81689

GEM (nimp3) wrote :

or a script for all version for "print" :


# module cbprint
# (C) 2008 Gribouillis at
"""This module defines a Print function to use with python 2.x or 3.x.
from cbprint import Print
Print("hello", "world")
It's interface is that of python 3.0's print. See
__all__ = ["Print"]
import sys
    Print = eval("print") # python 3.0 case
except SyntaxError:
        D = dict()
        exec("from __future__ import print_function\np=print", D)
        Print = D["p"] # 2.6 case
        del D
    except SyntaxError:
        del D
        def Print(*args, **kwd): # 2.4, 2.5, define our own Print function
            fout = kwd.get("file", sys.stdout)
            w = fout.write
            if args:
                sep = kwd.get("sep", " ")
                for a in args[1:]:
            w(kwd.get("end", "\n"))