2010-06-04から1日間の記事一覧

C 言語で split 処理を関数化したらコピペの方が良いと言われた

c

区切り文字があるデータ構造を分割する場合、Python なら以下のように split メソッドを使用すれば良いです。 $ python -c "print 'a,b,c,33,e'.split(',')" ['a', 'b', 'c', '33', 'e'] $ python -c "print 'a,,c,,e'.split(',')" ['a', '', 'c', '', 'e'] …