From 1713b5e5f0f9a9313bee113ff8f926c3575b1253 Mon Sep 17 00:00:00 2001 From: mischa Date: Sat, 2 Nov 2019 08:59:13 +0100 Subject: [PATCH] added light type, and formatting --- get-lights.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/get-lights.py b/get-lights.py index a8bb1e8..d8659b9 100755 --- a/get-lights.py +++ b/get-lights.py @@ -37,8 +37,7 @@ with urllib.request.urlopen(req, context=no_cert_check) as response: content = response.read() json_data = json.loads(content) -#p = re.compile("([a-fA-F0-9]{2}:?){8}") -#sensors = collections.defaultdict(list); - +print(f"{'ID':>2s}: {'Name':<30s} Type") +print ("################################################################################") for key in json_data: - print(f"{key}: {json_data[key]['name']}") + print(f"{key:>2s}: {json_data[key]['name']:<30s} {json_data[key]['type']}")