{"author_name":"pknight","categories":["Python3"],"blog_title":"(void*)P\u306a\u3044\u3068","url":"https://pknight.hatenablog.com/entry/20170404/1491272167","type":"rich","height":"190","blog_url":"https://pknight.hatenablog.com/","provider_url":"https://hatena.blog","version":"1.0","published":"2017-04-04 11:16:07","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpknight.hatenablog.com%2Fentry%2F20170404%2F1491272167\" title=\"sub\u306b\u3088\u308b\u6587\u5b57\u5217\u306e\u7f6e\u63db - (void*)P\u306a\u3044\u3068\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_url":"https://blog.hatena.ne.jp/pknight/","description":"\u5165\u9580Python3 7.1.5 sub\u3067\u6587\u5b57\u5217\u306e\u7f6e\u63db\u304c\u3067\u304d\u307e\u3059\u3002 import re str1 = \"aa11bb22cc33bb\" str2 = re.sub(r'\\d+',':',str1) print(str2) $ py main.py aa:bb:cc:bb \u30b0\u30eb\u30fc\u30d7\u5316\u3057\u3066\u5f8c\u65b9\u53c2\u7167\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002 import re str1 = \"aa11bb22cc33bb\" str2 = re.sub(r'(\\d+)',r'[\\1]',str1) print(str2) $ py main.py aa[11]bb[22]cc[33]bb \u307e\u305f\u95a2\u6570\u3092\u6307\u5b9a\u3057\u3066\u5f8c\u65b9\u53c2\u7167\u3092\u95a2\u6570\u3067\u53d7\u3051\u53d6\u308b\u3053\u3068\u3082\u3067\u304d\u2026","width":"100%","image_url":null,"title":"sub\u306b\u3088\u308b\u6587\u5b57\u5217\u306e\u7f6e\u63db","provider_name":"Hatena Blog"}