I have written a small Qt-based text editor for Python code that I embed in my application. Now I am going to switch to Python 3 and I want to help the users of my app with converting their code. I know that 2to3
can do most of the conversion for files. However, I need an on-the-fly conversion, without touching the files on disk. I mean something like:
py3_code_str = convert2to3(py2_code_str)
Does anybody know how it can be achieved with 2to3
or lib2to3
?