回答編集履歴
3
情報の追加
answer
CHANGED
@@ -4,4 +4,40 @@
|
|
4
4
|
[Pythex](http://pythex.org)
|
5
5
|
|
6
6
|
私は少しトライしてみたのですが、どうもうまくいきませんでした。
|
7
|
-
確かにこういう場合、正規表現で一発で取得できたら気持ちいですよね。
|
7
|
+
確かにこういう場合、正規表現で一発で取得できたら気持ちいですよね。
|
8
|
+
|
9
|
+
追記
|
10
|
+
正規表現でsplitができるみたいなので、できそうです。
|
11
|
+
|
12
|
+
```python
|
13
|
+
text = """
|
14
|
+
NICK FURY
|
15
|
+
Until such time as the world ends, we
|
16
|
+
will act as though it intends to spin
|
17
|
+
on. Clear out the tech below. Every
|
18
|
+
piece of PHASE 2 on a truck and gone.
|
19
|
+
|
20
|
+
NICK FURY
|
21
|
+
We've prepared for this, doctor.
|
22
|
+
Harnessing energy from space.
|
23
|
+
"""
|
24
|
+
serif = re.split("[A-Z]+ [A-Z]+ \n", text)
|
25
|
+
|
26
|
+
for s in serif:
|
27
|
+
print s
|
28
|
+
|
29
|
+
|
30
|
+
#実行結果
|
31
|
+
"""
|
32
|
+
|
33
|
+
Until such time as the world ends, we
|
34
|
+
will act as though it intends to spin
|
35
|
+
on. Clear out the tech below. Every
|
36
|
+
piece of PHASE 2 on a truck and gone.
|
37
|
+
|
38
|
+
|
39
|
+
We've prepared for this, doctor.
|
40
|
+
Harnessing energy from space.
|
41
|
+
|
42
|
+
"""
|
43
|
+
```
|
2
誤字訂正
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
正規表現、勉強中です。
|
2
2
|
|
3
3
|
正規表現を調べるために下記のサイトが使えます。
|
4
|
-
[
|
4
|
+
[Pythex](http://pythex.org)
|
5
5
|
|
6
6
|
私は少しトライしてみたのですが、どうもうまくいきませんでした。
|
7
7
|
確かにこういう場合、正規表現で一発で取得できたら気持ちいですよね。
|
1
URLのリンクを有効にした
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
正規表現、勉強中です。
|
2
2
|
|
3
3
|
正規表現を調べるために下記のサイトが使えます。
|
4
|
-
http://pythex.org
|
4
|
+
[リンク内容](http://pythex.org)
|
5
5
|
|
6
6
|
私は少しトライしてみたのですが、どうもうまくいきませんでした。
|
7
7
|
確かにこういう場合、正規表現で一発で取得できたら気持ちいですよね。
|