Sublime Forum

Using python to manipulate data from within ST2?

#1

I have a txt file with text and some numbers in decimal format.
Is it possible to use the built-in python to manipulate the numbers? e.g. after I mark all of them with regex (multiple clipboards), apply a round() function to them ? that would be neat!!

thanks!

0 Likes

#2

(I’m obviously a python newbie)
I managed to pull this off in the console

sublime.set_clipboard(str(round(float(sublime.get_clipboard().split('\n')[0]),1)))

which is still far from what I need, but, geez, ST2 is a beast !!

0 Likes