How to modify this from Python 2.x to v3.4?

Rick Johnson rantingrickjohnson at gmail.com
Sat Nov 11 22:07:07 EST 2017


On Saturday, November 11, 2017 at 8:07:06 PM UTC-6, jf... at ms4.hinet.net wrote:
[...]
> By the way, does anyone know what the following codes does?
> (in printer.py file) and how to convert it to v3.x?
> 
> class WrapperPrinter:
>     def __init__(self,outpath,options,data):
>         ...
>         ...
>         self.print_header()
>         print >>self.file
>         
>         self.print_preamble()
>         print >>self.file
> 
>         self.print_loader()
>         print >>self.file
>         ...
>         ...

`print` was changed from a statement to a function, so it's
just a matter of converting it to a function call. If you
read the docs for the new print function, it should be
relatively easy to translate. I don't understand why you're
having so much trouble.

    https://docs.python.org/3/whatsnew/3.0.html?highlight=print#common-stumbling-blocks



More information about the Python-list mailing list