回答編集履歴

3

情報の追加

2015/10/11 16:47

投稿

K_S_
K_S_

スコア419

test CHANGED
@@ -11,3 +11,75 @@
11
11
  私は少しトライしてみたのですが、どうもうまくいきませんでした。
12
12
 
13
13
  確かにこういう場合、正規表現で一発で取得できたら気持ちいですよね。
14
+
15
+
16
+
17
+ 追記
18
+
19
+ 正規表現でsplitができるみたいなので、できそうです。
20
+
21
+
22
+
23
+ ```python
24
+
25
+ text = """
26
+
27
+ NICK FURY
28
+
29
+ Until such time as the world ends, we
30
+
31
+ will act as though it intends to spin
32
+
33
+ on. Clear out the tech below. Every
34
+
35
+ piece of PHASE 2 on a truck and gone.
36
+
37
+
38
+
39
+ NICK FURY
40
+
41
+ We've prepared for this, doctor.
42
+
43
+ Harnessing energy from space.
44
+
45
+ """
46
+
47
+ serif = re.split("[A-Z]+ [A-Z]+ \n", text)
48
+
49
+
50
+
51
+ for s in serif:
52
+
53
+ print s
54
+
55
+
56
+
57
+
58
+
59
+ #実行結果
60
+
61
+ """
62
+
63
+
64
+
65
+ Until such time as the world ends, we
66
+
67
+ will act as though it intends to spin
68
+
69
+ on. Clear out the tech below. Every
70
+
71
+ piece of PHASE 2 on a truck and gone.
72
+
73
+
74
+
75
+
76
+
77
+ We've prepared for this, doctor.
78
+
79
+ Harnessing energy from space.
80
+
81
+
82
+
83
+ """
84
+
85
+ ```

2

誤字訂正

2015/10/11 16:47

投稿

K_S_
K_S_

スコア419

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  正規表現を調べるために下記のサイトが使えます。
6
6
 
7
- [リンク内容](http://pythex.org)
7
+ [Pythex](http://pythex.org)
8
8
 
9
9
 
10
10
 

1

URLのリンクを有効にした

2015/10/11 15:47

投稿

K_S_
K_S_

スコア419

test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  正規表現を調べるために下記のサイトが使えます。
6
6
 
7
- http://pythex.org
7
+ [リンク内容](http://pythex.org)
8
8
 
9
9
 
10
10