How to join each elements with a delimiter at (1) beginning and end of the
list and (2) connecting all elements  of the list

Example :

>>> value_list =  [1, 2, 3, 4, 56, 's']   I want this to be converted in
this  from '||1||2||3||4||56||s||'

Here is my solution

>>> values = '||' + '||'.join(map(str, value_list)) + '||'
>>> values

'||1||2||3||4||56||s||'


Iam joining the elements at the beginning and end of the list using '+'
operator any other solution, this is not looking neater


I am a Linux user using python 2.7


Regards,
Ganesh
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to