python: groups example

* Tightened code a little more.

Signed-off-by: Ben McGinnes <ben@adversary.org>
This commit is contained in:
Ben McGinnes 2018-12-21 21:01:04 +11:00
parent daded49254
commit dc5f416351
2 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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()