Skip to content

Instantly share code, notes, and snippets.

@jvorcak
Created January 30, 2020 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvorcak/c99051beb83d9eae3570e21f15bcafb4 to your computer and use it in GitHub Desktop.
Save jvorcak/c99051beb83d9eae3570e21f15bcafb4 to your computer and use it in GitHub Desktop.
Python join for objects
from itertools import chain
list(chain.from_iterable((a, 1) for a in ['a', 'b', 'c']))[:-1]
Out: ['a', 1, 'b', 1, 'c']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment