python - Replace ends of string in eclipse -
i trying refactor large source base in company work in. instead of using print function in python 2.7x want use logger function. example: print "sample print %d" % timestamp logger.info("sample print %d" % timestamp)
so basically, want remove print , , insert remains parentheses , logger.info (ill assume current prints info until full refactor possible).
thanks in advance
search (^\s+)print (.*)$
replace $1logger.info($2)
python should complain pretty fast places print
goes on more single line. you'll have fix places manually.
note: skips comments
the alternative source 2to3.py
replaces print ...
print(...)
convert code python 2 3.
Comments
Post a Comment