リンク
ちゃんと調べるときは
http://www.python.jp/doc/release/
Wiki内検索
最近更新したページ
最新コメント
文字コードの判定 by awesome things!
正規表現 by awesome things!
辞書 by stunning seo guys
文字列の16進変換 by check it out
文字コードの変換 by check this out
デバッガ by check this out
サブプロセス by watch for this
文字コードの判定 by watch for this
サニタイジング by check this out
タグ

文字列を分割してリストにする。(split)

splitは文字列のメソッドになってる。


>>> s = 'abc/def/ghi/jkl'
>>> s.split('/')
['abc', 'def', 'ghi', 'jkl']
>>>

正規表現をつかう場合


>>> import re
>>> r = re.compile('[ceg]')
>>> r.split(s)
['ab', '/d', 'f/', 'hi/jkl']
>>>

csvを使う


Python2.3以降なら、csvモジュールを使う。
2008年09月17日(水) 13:48:28 Modified by hebi_




スマートフォン版で見る