Replace the brackets with parentheses, so like this

basket1 = ['bread', 'cake', 'soap']

For multi-dimensional arrays, write

baskets = [['bread', 'cake', 'soap'], ['carrot', 'milk', 'wheat']]
Answer from supernova on Stack Overflow
🌐
PragmaticLinux
pragmaticlinux.com › home › how to create an array of strings in python
How to create an array of strings in Python - PragmaticLinux
September 27, 2022 - Example: # Read the value at index 1 my_value = my_numbers[1] # Print the value print(my_value) This prints out the value 1500. A string in Python is basically a variable that stores text.
People also ask

How do I create an array of strings in Python?
Use a list of strings for the general case, or choose a library such as NumPy when its dtype, vectorization, and memory behavior fit the workload.
🌐
pythonpool.com
pythonpool.com › home › tutorials › array of strings in python: lists, array, and numpy
Array of Strings in Python: Lists, array, and NumPy - Python Pool
Can Python's array module store strings?
The standard array module is designed for numeric type codes, so a list or a string-focused library is usually more appropriate for arbitrary text.
🌐
pythonpool.com
pythonpool.com › home › tutorials › array of strings in python: lists, array, and numpy
Array of Strings in Python: Lists, array, and NumPy - Python Pool
How do I check that every item is a string?
Validate with an explicit predicate such as all(isinstance(item, str) for item in values) at the boundary where the data contract matters.
🌐
pythonpool.com
pythonpool.com › home › tutorials › array of strings in python: lists, array, and numpy
Array of Strings in Python: Lists, array, and NumPy - Python Pool
🌐
W3Schools
w3schools.com › python › python_arrays.asp
Python Arrays
Remove List Duplicates Reverse a String Add Two Numbers · Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... Note: Python does not have built-in support for Arrays, but Python Lists can be used instead.
🌐
W3Schools
w3schools.com › python › gloss_python_strings_are_arrays.asp
Python Strings Are Arrays
Like many other popular programming ... are arrays of bytes representing unicode characters. However, Python does not have a character data type, a single character is simply a string with a length of 1. Square brackets can be used to access ...
🌐
freeCodeCamp
freecodecamp.org › news › python-string-to-array-how-to-convert-text-to-a-list
Python String to Array – How to Convert Text to a List
February 21, 2022 - For example, let's take the text "Python". You can convert it to a list of characters, where each list item would be every character that makes up the string "Python".
🌐
Python Pool
pythonpool.com › home › tutorials › array of strings in python: lists, array, and numpy
Array of Strings in Python: Lists, array, and NumPy - Python Pool
July 13, 2026 - Store strings in Python with lists, the array module, or NumPy, and choose the right representation for typing, performance, indexing, and text operations.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-create-string-array-in-python
How to Create String Array in Python - GeeksforGeeks
July 16, 2026 - ... Explanation: list stores each string as a separate element. The expression arr[1] accesses the second element of the list. NumPy provides the array() function to create arrays containing string values.
Find elsewhere
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › string array in python
String Array in Python | Know List And Methods of String Array in Python
March 16, 2023 - String Array can be defined as the capacity of a variable to contain more than one string value at the same time, which can be called and accessed at any time in the program during the execution process.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
Top answer
1 of 2
3

If you fix the lenght of the array, you can just create a list with a none value

keyword = [''] * 100   # list of 100 element
keyword[0] = 'Blue Light Glasses'
keyword[1] = "Tech Fleece Joggers"

You can also create a empty list and add element in this list

keyword = list()
keyword.append('Blue Light Glasses')
keyword.append('Tech Fleece Joggers')
print(keyword)

Output:

['Blue Light Glasses', 'Tech Fleece Joggers']
2 of 2
0

there isn't a way in python to declare a array of a fixed lenght but there are some "tricks" to do this as:

lenght = 100
# You are creating an array of 100 None items
listOfNone = [None] * lenght

Another thing you can't do is declare an array of that fixed value type (like string). You can create an array only made of string but at any time you could replace a string element of the array with an int for example. Here is an example:

lenght = 100
# Declaring an array made of 100 "a beautiful string" repeating
listOfStrings = ["a beautiful string"] * lenght 
# Replacing the tenth element with a 12 (type int)
listOfStrings[9] = 12
# You can check the type of the element in python by printing:
print(type(listOfStrings[9])) # This will print int
print(type(listOfStrings[8])) # This will print string. As you can see there are 2 types of var in the same list (python doesn't matter)
listOfStrings[24] = False #Placing a bool in the 25th element

There is a workaround to this: you can create a function that handles the array (or use a class too, but I don't know your Python level). I'm typing a basic function for you that you can adjust for your needs

def fillArrayWithElement(array, element):
    if not str(type(array)) == "<class 'list'>":
        # The array is not an array
        raise ValueError('The first parameter must be list type')
        return
    if not str(type(prova2)) == "<class 'str'>":
        # The element to add is not a string
        raise ValueError('The element must be str type')
        return
    array.append(element)
    return array
🌐
New York University
physics.nyu.edu › pine › pymanual › html › chap3 › chap3_arrays.html
3. Strings, Lists, Arrays, and Dictionaries — PyMan 0.9.31 documentation
The elements of lists and arrays are numbered consecutively, and to access an element of a list or an array, you simply refer to the number corresponding to its position in the sequence. The elements of dictionaries are accessed by “keys”, which can be either strings or (arbitrary) integers (in no particular order). Dictionaries are an important part of core Python.
🌐
CodeRivers
coderivers.org › blog › python-string-array
Python String Arrays: A Comprehensive Guide - CodeRivers
April 6, 2025 - In Python, there is no dedicated string array data type. Instead, you use **lists** to store sequences of strings. A list of strings—often called a string array—is one of the most common data structures in Python, used in everything from text processing and data analysis to web scraping ...
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › python string to array
Python String to Array | How to Convert String to an Array with Examples?
October 13, 2023 - Converting a Python string to an array involves breaking down a string into individual elements or characters and storing them as an ordered sequence in an array. This is commonly achieved using the split() method, which divides the string based on a specified delimiter, such as a space or comma, and generates an array of substrings.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
W3Schools
w3schools.com › python › python_strings.asp
Python Strings
Like many other popular programming languages, strings in Python are arrays of unicode characters.
🌐
Awkward-array
awkward-array.org › doc › main › user-guide › how-to-create-strings.html
How to create arrays of strings — Awkward Array 2.14.0 documentation
Awkward Arrays can contain strings, although these strings are just a special view of lists of uint8 numbers. As such, the variable-length data are efficiently stored. NumPy’s strings are padded to have equal width, and Pandas’s strings are Python objects.
🌐
YouTube
youtube.com › shorts › FAmL6qExL7I
The Secret to String Arrays in Python! 🔥⚠️ - YouTube
Did you know that Python doesn't have a built-in string array type? Instead, it uses lists to store multiple string values efficiently.In this quick tutorial...
Published: March 14, 2026
🌐
YouTube
youtube.com › wrt tech
Python - Convert a String to an Array | Codewars 8KYU - YouTube
Super easy codewars problem for beginners
Published: June 29, 2022
Views: 2K
🌐
Medium
bubblesort.medium.com › arrays-and-strings-in-python-a-beginners-guide-b71fbcf38a05
Arrays and Strings in Python: A Beginner’s Guide | by Bubble Sort | Medium
February 1, 2024 - If you’re diving into the world of Python programming, you’ve likely encountered arrays and strings. These fundamental data types play a crucial role in many programs, making it essential to grasp their concepts.
🌐
Python
docs.python.org › 3 › library › array.html
array — Efficient arrays of numeric values — Python 3.15.2 documentation
3 weeks ago - The string representation is guaranteed to be able to be converted back to an array with the same type and value using eval(), so long as the array class has been imported using from array import array. Variables inf and nan must also be defined if it contains corresponding floating-point values.
🌐
Quora
quora.com › How-can-I-import-an-array-of-string-in-Python-or-what-is-the-type-code-to-make-an-array-of-string-if-any
How to import an array of string in Python or what is the type code to make an array of string (if any) - Quora
Answer: Python doesn’t have arrays. It has lists and other sequence types, which you can index like arrays. If you have a supply of strings from somewhere and you want to put them in an array (list) then you often start with an empty list and append the strings, one by one. [code]>>> x = [] >>>...