I recently inherited some legacy code and I wanted to replace all occurrences like:
print "xx"
print x,y
print 'xx'
to
logging.info("xy")
or
logging.info(x,y)
Building on the previous answer and in hopes that someone will benefit from it I used the following scriptcommand, that will change all occurrences:
%s/print\( .\*\*\)/logging.info\(\1\)/g
If you substitute % with . and remove /g you will end up
with
.s/print\( .\*\*\)/logging.info\(\1\)
that will enable you to go over each match and choose whether you change it or not.