Is there a way I could convert a python2 string to a python3 string by calling 2to3
in python without having to call it via command line?
input = 'a=raw_input()'
output = 'a=input()'
CodePudding user response:
2to3
is open source:
https://github.com/python/cpython/tree/3.10/Lib/lib2to3/
The refactor_string
function is what you're looking for.