I would have written a generator myself, but like this:
def joinit(iterable, delimiter):
it = iter(iterable)
yield next(it)
for x in it:
yield delimiter
yield x
More Related Contents:
- How to iterate through two lists in parallel?
- Transpose/Unzip Function (inverse of zip)?
- Are lists thread-safe?
- Python List vs. Array – when to use?
- How can I iterate through two lists in parallel?
- Getting a list of values from a list of dicts
- Pairs from single list
- Splitting a list based on a delimiter word
- Naming conflict with built-in function
- How do I split a list into equally-sized chunks?
- How can I make a dictionary from separate lists of keys and values?
- What is the time complexity of popping elements from list in Python?
- How can I generate a list of consecutive numbers?
- Accessing a value in a tuple that is in a list
- Python passing list as argument
- Confusing […] List in Python: What is it?
- How to delete an item in a list if it exists?
- Flattening a list recursively [duplicate]
- remove None value from a list without removing the 0 value
- Python: Remove Duplicate Items from Nested list
- Changing one dict changes all dicts in a list of dicts [duplicate]
- Python string.join(list) on object array rather than string array
- How to sort multidimensional array by column?
- sum each value in a list of tuples
- Creating sublists [duplicate]
- Can’t sort my list because it is NoneType? Simple Python [duplicate]
- How to sort a list of dictionaries by a value of the dictionary in Python?
- Why Python `Memory Error` with list `append()` lots of RAM left
- How to create a nested dictionary from a list in Python?
- Store functions in list and call them later [duplicate]