Skip to content

Instantly share code, notes, and snippets.

@ichiren1
ichiren1 / python_re_in_lc.py
Last active August 29, 2015 14:25 — forked from dogrunjp/python_re_in_lc.py
Pythonはリスト内包表記の中で正規表現が使えるとのこと。テキスト処理に使えそう。
>>>import re
>>>list = ['a', '1', 'bc', '-b', '2a','100']
>>>r = re.compile("[a-z]")
>>>[x for x in list if r.mathch(x)]
['a','bc']