I\'m a Python noob and I need some help for a simple problem.
What I need to do is create a list with 3 items and add spaces before and after every item.
For
As always, use a list comprehension:
lst = [' {0} '.format(elem) for elem in lst]
This applies a string formatting operation to each element, adding the spaces. If you use python 2.7 or later, you can even omit the 0 in the replacement field (the curly braces).
0