- くだすれPython(超初心者用) その28©2ch.net
148 :デフォルトの名無しさん[sage]:2015/11/24(火) 17:49:54.93 ID:xz7o/8Yr - 正規表現を使うならreが必要
import re import sys def f(start, end, file): for line in file: if start.search(line): print(line, end='') break for line in file: print(line, end='') if end.search(line): return f(re.compile('hoge1'), re.compile('hoge2'), sys.stdin)
|
|