teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

戻し切れていない部分を戻しました

2021/06/30 07:34

投稿

Third_Kei
Third_Kei

スコア65

answer CHANGED
@@ -14,7 +14,7 @@
14
14
  for j,txt2 in enumerate(splited):
15
15
  if j != len(splited) -1 :
16
16
  txt2 += "。" #splitで消えた「。」の補充
17
- if txt2 == "。": #ここで"。"のみを無視
17
+ if txt2 == "" or txt2 == "。": #ここで"。"のみを無視
18
18
  pass
19
19
  else:
20
20
  comment2 += [txt2]

2

変更点をもとに戻しました

2021/06/30 07:34

投稿

Third_Kei
Third_Kei

スコア65

answer CHANGED
@@ -12,7 +12,8 @@
12
12
  for i,txt in enumerate(comment):
13
13
  splited = txt.split("。")
14
14
  for j,txt2 in enumerate(splited):
15
+ if j != len(splited) -1 :
15
- txt2 += "。" #splitで消えた「。」の補充
16
+ txt2 += "。" #splitで消えた「。」の補充
16
17
  if txt2 == "。": #ここで"。"のみを無視
17
18
  pass
18
19
  else:

1

プログラムを若干効率化しました

2021/06/30 07:33

投稿

Third_Kei
Third_Kei

スコア65

answer CHANGED
@@ -12,9 +12,8 @@
12
12
  for i,txt in enumerate(comment):
13
13
  splited = txt.split("。")
14
14
  for j,txt2 in enumerate(splited):
15
- if j != len(splited) - 1: #splitで消えた「。」の補充
15
+ txt2 += "。" #splitで消えた「。」の補充
16
- txt2 += "。"
17
- if txt2 == "" or txt2 == "。": #ここで"。"と""の無視
16
+ if txt2 == "。": #ここで"。"のみを無視
18
17
  pass
19
18
  else:
20
19
  comment2 += [txt2]