loial wrote: > Is there a quick way to concatenate all the values in a list into a > string, except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. > > Any help appreciated
>>> strings ['All', 'values', 'in', 'list', 'will', 'be', 'strings'] Build a new list without the first item: >>> strings[1:] ['values', 'in', 'list', 'will', 'be', 'strings'] Concatenate the strings: >>> "|".join(strings[1:]) 'values|in|list|will|be|strings' If you don't want a separator invoke the join method on an empty string: >>> "".join(strings[1:]) 'valuesinlistwillbestrings' -- https://mail.python.org/mailman/listinfo/python-list