Python – Create a List of Strings

Create a list of strings

To create a list of strings in Python, you can create an empty list and add string elements to the list, or initialise the list with just string elements.

Examples

1. Create empty list and add string elements

In the following program we create an empty list x and add string elements to this list using append() function.

Python Program

x = []
x.append('apple')
x.append('banana')
x.append('cherry')

print(x)
Run

Output

['apple', 'banana', 'cherry']

2. Initialize list with string elements

In the following program we create a list x and initialised it with string elements.

Python Program

x = ['apple', 'banana', 'cherry']

print(x)
Run

Output

['apple', 'banana', 'cherry']

Summary

In this tutorial of Python Examples, we learned how to create a list with string elements, with the help of examples.