I'm looking for a way to flatten lists inside a list literal, kind of like
this:

>>> start = '('
>>> end = ')'
>>> items = ['abc', '+', 'def']
>>> [start, *items, end]
['(', 'abc', '+', 'def', ')']

Of course, the star doesn't work there. Is there any easy,
syntactically-lightweight way to get that output?

Thanks,
John
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to