Menu Close

How to append the same string to a list of strings in Python?

Sometimes, we want to append the same string to a list of strings in Python.

In this article, we’ll look at how to append the same string to a list of strings in Python.

How to append the same string to a list of strings in Python?

To append the same string to a list of strings in Python, we can use list comprehension.

For instance, we write

l = [s + my_string for s in my_list]

to append my_string to the end of each string s in the my_list list.

And then we return the values in a new list.

Conclusion

To append the same string to a list of strings in Python, we can use list comprehension.

Posted in Python, Python Answers