Two options using str.format():
goal = map('<li>{0}</li>'.format, l)
... or...
goal = ['<li>{0}</li>'.format(x) for x in l]
Note that in Python 3.x, an map()iterator will be returned instead of a list, so if you need a list, you will need to use list(map(...)).
source
share