docs: python bindings howto

* Fixed the groups.py script so it really does what is described (the
  old code had the same result for groups, group_lines and
  group_lists).
* Updated the corresponding example in the doc to match.
This commit is contained in:
Ben McGinnes 2018-05-25 05:22:16 +10:00
parent 9038d30017
commit 48e946a96d
2 changed files with 13 additions and 9 deletions

View File

@ -1352,11 +1352,13 @@
groups = line.split(":")[-1].replace('"', '').split(',') groups = line.split(":")[-1].replace('"', '').split(',')
group_lines = groups group_lines = []
for i in range(len(group_lines)): group_lists = []
group_lines[i] = group_lines[i].split("=")
for i in range(len(groups)):
group_lines.append(groups[i].split("="))
group_lists.append(groups[i].split("="))
group_lists = group_lines
for i in range(len(group_lists)): for i in range(len(group_lists)):
group_lists[i][1] = group_lists[i][1].split() group_lists[i][1] = group_lists[i][1].split()
#+end_src #+end_src

View File

@ -41,10 +41,12 @@ for i in range(len(lines)):
groups = line.split(":")[-1].replace('"', '').split(',') groups = line.split(":")[-1].replace('"', '').split(',')
group_lines = groups group_lines = []
for i in range(len(group_lines)): group_lists = []
group_lines[i] = group_lines[i].split("=")
for i in range(len(groups)):
group_lines.append(groups[i].split("="))
group_lists.append(groups[i].split("="))
group_lists = group_lines
for i in range(len(group_lists)): for i in range(len(group_lists)):
group_lists[i][1] = group_lists[i][1].split() group_lists[i][1] = group_lists[i][1].split()