You can use literal_eval in the ast module

>>> from ast import literal_eval
>>> s = "['a',['b','c','d'],'e']"
>>> print(literal_eval(s))
['a', ['b', 'c', 'd'], 'e']
Answer from Padraic Cunningham on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-ways-to-convert-array-of-strings-to-array-of-floats
Python | Ways to convert array of strings to array of floats - GeeksforGeeks
July 11, 2025 - Here is the approach to convert an array of strings from Python to an array float using loop and float functions. Create an empty array to store the converted floats. Loop through each element of the input array and convert the current element ...
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ third party โ€บ numpy โ€บ fromstring()
Python Numpy fromstring() - Convert String to Array | Vultr Docs
November 18, 2024 - The fromstring() function in Python's NumPy library is a powerful tool for converting string data into numerical arrays quickly and efficiently.
๐ŸŒ
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 - The code defines a function called string_to_array that takes a string s and converts it into an array of characters. It then uses this function to convert the โ€˜Educba Trainingโ€™ string into an array of individual characters and prints the ...
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
๐ŸŒ
Python Guides
pythonguides.com โ€บ convert-string-to-array-in-python
Convert String To Array In Python
May 16, 2025 - Learn how to convert a string to an array in Python using the split() method, list() constructor, or custom logic for more control over element separation.
๐ŸŒ
Java2Blog
java2blog.com โ€บ home โ€บ python โ€บ convert string array to int array in python
Convert String Array to Int Array in Python [3 ways] - Java2Blog
December 25, 2022 - The eval() function accepts a Python string and evaluates it as a Python expression. We can use it in place of the int() function in the previous method. ... Use the map() function to apply the int() function to all elements of the array. Use the list() function to convert the map type object ...
Find elsewhere
๐ŸŒ
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
๐ŸŒ
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 - You do this by using the built-in list() function and passing the given string as the argument to the function. programming_language = "Python" programming_language_list = list(programming_language) print(programming_language_list) #output #['P', ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 73352802 โ€บ python-convert-an-array-string-into-an-array
Python,convert an array string into an array - Stack Overflow
It could also be done using the eval function as stated in the other answer. I advise against that, because eval can be very dangerous if you are getting the string as an input from the user. You probably really don't want to create a variable for every item of your array input.
๐ŸŒ
Appdividend
appdividend.com โ€บ converting-string-to-numpy-array-in-python
How to Convert a String to Numpy Array in Python
September 7, 2025 - To convert string to array in Python, you can use numpy.fromstring() method. It is the most efficient and faster way.
๐ŸŒ
PyTutorial
pytutorial.com โ€บ python-string-to-array-conversion-guide
PyTutorial | Python String to Array Conversion Guide
August 15, 2026 - If you work with numerical data, you might need a NumPy array. The numpy.array() function can convert a string to an array of characters or numbers.
๐ŸŒ
Replit
replit.com โ€บ home โ€บ discover โ€บ how to convert a string to an array in python
How to convert a string to an array in Python | Replit
April 14, 2026 - Learn how to convert a string to an array in Python. Explore various methods, tips, real-world examples, and common error debugging.
๐ŸŒ
DEV Community
dev.to โ€บ itsmycode โ€บ how-to-convert-python-string-to-array-3fpb
How To Convert Python String To Array - DEV Community
December 8, 2021 - In Python, we do not have an in-built array data type. However, we can convert Python string to list, which can be used as an array type.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ convert list to array python
Convert List to Array Python - Scaler Topics
May 4, 2023 - A list in python is a linear data structure that may hold a variety of elements of different types. A NumPy array is a data structure that can hold homogeneous (same type) items. There are three methods to convert list to array in python and these are, by using the array(), by using the numpy.array(), or by using the numpy.asarray().