[Tutor] joining selected items in list

Emile van Sebille emile at fenx.com
Sun Jun 24 20:26:21 CEST 2012


On 6/24/2012 9:11 AM David said...
> Dear Tutors,
>
> 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'].

Can you define the complete list of items that belong together?

If so, there's are several techniques for locations a sub-list within a 
list at 
http://stackoverflow.com/questions/2250633/python-find-a-list-within-members-of-another-listin-order

But if not, I'm not sure there's an answer.

Emile



>
> I am not aware of any list methods that can help me here, and would thus
> be grateful for a hint or two.
>
> Thank you!
>
> David
>
>
>
> Original list:
>
>
> [['Intervall-', 'Anzahl', 'Rufzeit', 'Rufzeit', 'Rufzeit', 'Rufzeit',
> '>', 'Mittlere', 'Anzahl', 'Unzul\xe4ssiger', '\xdcberlauf',
> 'Zielanschlu\xdf', 'keine', 'Antwort', 'nicht', 'aktiv',
> 'Ung\xfcltiger', 'REST', '(andere']]
>
> What I want is this:
>
> [['Intervall-',
> 'Anzahl',
> 'Rufzeit',
> 'Rufzeit',
> 'Rufzeit',
> 'Rufzeit>',
> 'Mittlere',
> 'Anzahl',
> 'Unzul\xe4ssiger',
> '\xdcberlauf',
> 'Zielanschlu\xdf',
> 'keine Antwort',
> 'nicht aktiv',
> 'Ung\xfcltiger',
> 'REST' (andere']]
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list