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

回答編集履歴

1

追記

2019/11/25 11:42

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -1,4 +1,17 @@
1
1
  数値化しなければ良いのでは。
2
2
  ```Python
3
3
  if (dict_json['report_num'] == '1') and (dict_json['report_time'] != BEFORE_dict_json['report_time']):
4
+ ...
5
+ ```
6
+
7
+ 条件が長すぎて読みづらいのは事実なので、適当に関数を用意してやっても良いでしょう。
8
+ ```Python
9
+ def cond(n_json, before_json): # 関数名は目的に合わせ適切に付け直してください
10
+ if n_json['report_num'] != '1':
11
+ return False
12
+
13
+ return n_json['report_time'] != before_json['report_time']
14
+
15
+ if cond(dict_json, BEFORE_dict_json):
16
+ ...
4
17
  ```