回答編集履歴

1

コードの編集

2018/01/04 19:28

投稿

namnium1125
namnium1125

スコア2043

test CHANGED
@@ -10,9 +10,11 @@
10
10
 
11
11
  def mail(m):
12
12
 
13
- sender = re.search(r'(\d+)kara',m[0]).group(1)
13
+ mat = re.search(r'(.+?)kara(.+?)he',m[0])
14
14
 
15
+ sender = mat.group(1)
16
+
15
- receiver = re.search(r'(\d+)he',m[0]).group(1)
17
+ receiver = mat.group(2)
16
18
 
17
19
  return (sender,receiver,m[1])
18
20
 
@@ -28,11 +30,17 @@
28
30
 
29
31
  global people
30
32
 
31
- s,r = map(lambda p: int(p)-1,(sen,rec))
33
+ try:
32
34
 
33
- people[s]['sent'].append(mes)
35
+ s,r = map(lambda p: int(p)-1,(sen,rec))
34
36
 
37
+ people[s]['sent'].append(mes)
38
+
35
- people[r]['received'].append(mes)
39
+ people[r]['received'].append(mes)
40
+
41
+ except Exception as e:
42
+
43
+ print('message '+"'"+mes+"'"+' couldn\'t be sent : '+str(e)+'\n')
36
44
 
37
45
 
38
46