2011-02-10から1日間の記事一覧

textwrap は覚えとこう

文字列を適当な長さで区切って diff を表示する - forest book のお題だけど、読み逃してる条件が無ければ textwrap で充分。 import textwrap def limit_characters(line, start, width): return textwrap.wrap(line[start:], width) def test_limit_charac…

このブログに乗せているコードは引用を除き CC0 1.0 で提供します。