From dc5f416351e47bfafb46a53f8fd8435dd6c231ba Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Fri, 21 Dec 2018 21:01:04 +1100 Subject: [PATCH] python: groups example * Tightened code a little more. Signed-off-by: Ben McGinnes --- lang/python/doc/src/gpgme-python-howto | 10 +++++----- lang/python/examples/howto/groups.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lang/python/doc/src/gpgme-python-howto b/lang/python/doc/src/gpgme-python-howto index 187339db..bee661b5 100644 --- a/lang/python/doc/src/gpgme-python-howto +++ b/lang/python/doc/src/gpgme-python-howto @@ -3023,12 +3023,12 @@ groups = line.split(":")[-1].replace('"', '').split(',') group_lines = [] group_lists = [] -for i in range(len(groups)): - group_lines.append(groups[i].split("=")) - group_lists.append(groups[i].split("=")) +for group in groups: + group_lines.append(group.split("=")) + group_lists.append(group.split("=")) -for i in range(len(group_lists)): - group_lists[i][1] = group_lists[i][1].split() +for glist in group_lists: + glist[1] = glist[1].split() #+END_SRC The result of that code is that =group_lines= is a list of lists where diff --git a/lang/python/examples/howto/groups.py b/lang/python/examples/howto/groups.py index 98659cce..81cb6e6a 100644 --- a/lang/python/examples/howto/groups.py +++ b/lang/python/examples/howto/groups.py @@ -54,9 +54,9 @@ groups = line.split(":")[-1].replace('"', '').split(',') group_lines = [] group_lists = [] -for i in range(len(groups)): - group_lines.append(groups[i].split("=")) - group_lists.append(groups[i].split("=")) +for group in groups: + group_lines.append(group.split("=")) + group_lists.append(group.split("=")) -for i in range(len(group_lists)): - group_lists[i][1] = group_lists[i][1].split() +for glist in group_lists: + glist[1] = glist[1].split()