Perform a string operation for every element in a Python list
You can use list comprehension:
elements = ["%" + e + "%" for e in elements]
elements = ['%{0}%'.format(element) for element in elements]
You can use list comprehensions:
elements = ["%{}%".format(element) for element in elements]