On 2017-10-31, Ganesh Pal <ganesh1...@gmail.com> wrote:
> Here is my solution
>
>>>> values = '||' + '||'.join(map(str, value_list)) + '||'
>>>> values
>
> '||1||2||3||4||56||s||'
>
> I am 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

You can use the % operator instead of +, and a generator
expression instead of map. It's a pretty small improvement,
though.

values = '||%s||' % ('||'.join(str(s) for s in value_list))

At least... I THINK you can use that generator expression in 2.7.

-- 
Neil Cerutti

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to