From 625b7926eb5d1825c50344d56c3fa483de7ba91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 25 Apr 2021 13:02:15 +0200 Subject: [PATCH] better processing --- kafka/consumer.py | 8 +++++++- rabbit/consumer.py | 8 +++++++- zmq/consumer.py | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/kafka/consumer.py b/kafka/consumer.py index 9dc0db7..e589c23 100644 --- a/kafka/consumer.py +++ b/kafka/consumer.py @@ -18,4 +18,10 @@ try: consumer.close() except KeyboardInterrupt: consumer.close() - print(DATETIMES) + dt = {} + for datetime in DATETIMES: + dts = datetime.strftime("%m/%d/%Y, %H:%M:%S") + if dts not in dt: + dt[strftime("%m/%d/%Y, %H:%M:%S")] = 1 + else: + dt[strftime("%m/%d/%Y, %H:%M:%S")] +=1 diff --git a/rabbit/consumer.py b/rabbit/consumer.py index e6cffef..fb0c61a 100644 --- a/rabbit/consumer.py +++ b/rabbit/consumer.py @@ -24,4 +24,10 @@ try: channel.start_consuming() except KeyboardInterrupt: connection.close() - print(DATETIMES) + dt = {} + for datetime in DATETIMES: + dts = datetime.strftime("%m/%d/%Y, %H:%M:%S") + if dts not in dt: + dt[strftime("%m/%d/%Y, %H:%M:%S")] = 1 + else: + dt[strftime("%m/%d/%Y, %H:%M:%S")] +=1 diff --git a/zmq/consumer.py b/zmq/consumer.py index d3b9cb3..6a18d68 100644 --- a/zmq/consumer.py +++ b/zmq/consumer.py @@ -18,4 +18,10 @@ try: DATETIMES.append(datetime.now()) except KeyboardInterrupt: socket.close() - print(DATETIMES) + dt = {} + for datetime in DATETIMES: + dts = datetime.strftime("%m/%d/%Y, %H:%M:%S") + if dts not in dt: + dt[strftime("%m/%d/%Y, %H:%M:%S")] = 1 + else: + dt[strftime("%m/%d/%Y, %H:%M:%S")] +=1