From 65265eede8dba19ea3462c455e456c59154f519d Mon Sep 17 00:00:00 2001 From: Paul Craven Date: Wed, 10 Nov 2021 09:05:37 -0600 Subject: [PATCH] Update code to use print formatting. --- manchester_decoding_1.py | 2 +- manchester_encoding.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manchester_decoding_1.py b/manchester_decoding_1.py index 4b43467..420f104 100644 --- a/manchester_decoding_1.py +++ b/manchester_decoding_1.py @@ -19,7 +19,7 @@ def data_callback(channel): time_interval = cur_time - data_callback.last_call dl = "L->H" if data_line else "H->L" - print(" Change: {} Interval: {:.3f}".format(dl, time_interval)) + print(f" Change: {dl} Interval: {time_interval:.3f}") data_callback.last_call = cur_time diff --git a/manchester_encoding.py b/manchester_encoding.py index b706d82..31e4760 100644 --- a/manchester_encoding.py +++ b/manchester_encoding.py @@ -68,7 +68,7 @@ time.sleep(CLOCK_SPEED) # print(bit, end="") - print(" - {:3} - {:}".format(my_byte, chr(my_byte))) + print(f" - {my_byte:3} - {chr(my_byte)}") time.sleep(CLOCK_SPEED * 4) GPIO.cleanup()