You can try something like this.
import re
with open("myprogram.py","r",encoding='utf8') as f:
for x in f.readlines():
y = x # Main code x defining as y.
if re.findall("print",x) == ['print']: # if 'print' is found;
x = "print(" + x.split("print")[1].strip() + ")" # strip it quotation mark and paranthesis;
y = y.replace(y,x) #.. replace y with x.
with open("different.py","a+") as ff:
(y.strip()) # attention using \n for every sentence..
But it may break your code's design. So print them and copy-paste.
import re
with open("myprogram.py","r",encoding='utf8') as f:
for x in f.readlines():
y = x # Main code x defining as y.
if re.findall("print",x) == ['print']: # if 'print' is found;
x = "print(" + x.split("print")[1].strip() + ")" # strip it quotation mark and paranthesis;
y = y.replace(y,x) #.. replace y with x.
print(y.strip())