Created
May 11, 2016 01:11
-
-
Save nwiizo/af076fb5b837a726dd834eb27d6c61c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import re | |
m = re.compile(r"\[\[File\:(?P<p1>.+?)\|.+\]\]|\[\[ファイル\:(?P<p2>.+?)\|.+\]\]") | |
#得にコメントなし | |
#[File:*] or [ファイル:*]でマッチさせる。 | |
#(?P<name>.+?)はテンプレ | |
with open("data02","rt") as f: | |
for l in f: | |
if m.match(l): | |
m_1 = m.search(l) | |
#m.serch(m,l)と同義 | |
if m_1.group("p1"): | |
print(m_1.group("p1")) | |
if m_1.group("p2"): | |
print(m_1.group("p2")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment