On Sun, 24 Jun 2012 18:11:10 +0200
David <[email protected]> wrote:
> I have a list that I wish to reorganise into fewer list items.
> What happens is that some of the items belong together:
> not ['keine', 'Antwort'] but ['Keine Antwort'].
>
> I am not aware of any list methods that can help me here, and would
> thus be grateful for a hint or two.
If you know the indeces of the items which belong together, you could
do for example:
l = [['Intervall-', 'Anzahl', 'Rufzeit', 'Rufzeit', 'Rufzeit',
'Rufzeit', '>', 'Mittlere', 'Anzahl', 'Unzul\xe4ssiger',
'\xdcberlauf', 'Zielanschlu\xdf', 'keine', 'Antwort', 'nicht',
'aktiv', 'Ung \xfcltiger', 'REST', '(andere']]
indices = [5, 12, 14, 17]
for index in reversed(indices):
l[0][index] = " ".join([l[0][index], l[0].pop(index + 1)])
Bye, Andreas
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor