Python "join" on both sides of strings?

list, python, string

Solution

Try string formatting and list comprehension, like so.

goal = ['<li>{0}</li>'.format(x) for x in l]

Problem

``` l = ['1','2','3'] goal = ['<li>1</li>','<li>2</li>'] ``` How can I get `goal` from `l`? I'm playing with list comprehensions but it's messy!

Original source