MacOS限定
#!/usr/bin/env python # *-# -*- coding: utf-8 -*- import re import commands from Carbon import Scrap def insert_comma(txt): return re.sub(r"(\d)(?=(\d{3})+(?!\d))", r"\1,", txt) def toClipboard(txt): Scrap.ClearCurrentScrap() Scrap.GetCurrentScrap().PutScrapFlavor('TEXT', 0, txt) if __name__ == '__main__': txt = commands.getoutput("pbpaste") toClipboard(insert_comma(txt))