You can use the str.split method.

>>> my_string = 'A,B,C,D,E'
>>> my_list = my_string.split(",")
>>> print my_list
['A', 'B', 'C', 'D', 'E']

If you want to convert it to a tuple, just

>>> print tuple(my_list)
('A', 'B', 'C', 'D', 'E')

If you are looking to append to a list, try this:

>>> my_list.append('F')
>>> print my_list
['A', 'B', 'C', 'D', 'E', 'F']
Answer from Matt Williamson on Stack Overflow
🌐
Make Community
community.make.com › questions
Convert a String containing commas as separators into an Array - Questions - Make Community
January 31, 2023 - I have a string of text “01pdf1,01sb1”. The comma in the text is a separator between two elements: “01pdf1” and “01sb1”. I want to conduct a series of operations for each element. In order to do this, I think I should use the iterator module. In order to use the iterator, I need to convert this original text string into an array so that it can deal with each element separately.
🌐
Codingem
codingem.com › home › how to convert comma-delimited string to a list in python
How to Convert Comma-Delimited String to a List in Python - codingem.com
November 2, 2022 - To convert comma-delimited string to a list in Python, use str.split() method. For example "A,B,C".split(",") returns a list ["A", "B", "C"]
🌐
GeeksforGeeks
geeksforgeeks.org › convert-comma-separated-string-to-array-in-pyspark-dataframe
Convert comma separated string to array in PySpark dataframe - GeeksforGeeks
May 23, 2021 - In pyspark SQL, the split() function converts the delimiter separated String to an Array. It is done by splitting the string based on delimiters like spaces, commas, and stack them into an array.
🌐
Workato
systematic.workato.com › t5 › workato-pros-discussion-board › convert-comma-separated-string-to-list-array › m-p › 9871
Solved: Re: Convert comma-separated string to list / array - Systematic Community - 9867
April 9, 2026 - Although we can accomplish this in Workato using a while loop, by employing an index in the while loop on the values obtained after Related>.split(",") and accumulating them into a list variable one by one, ending the while loop when there is no data, and then use the list for for each loop. This approach will require more tasks based on the number of comma-separated values. Alternatively, you can write a simple python, ruby or javascript do do the same; this will be a better solution in terms of task consumption.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-convert-comma-delimited-string-to-a-list-in-python
How To Convert Comma-Delimited String to a List In Python? - GeeksforGeeks
July 23, 2025 - The most straightforward and efficient way to convert a comma-delimited string to a list is by using Python’s built-in split() method. This method works by splitting the string based on a given delimiter.
🌐
Codemia
codemia.io › home › knowledge hub › how can i convert a comma-separated string to an array?
How can I convert a comma-separated string to an array? | Codemia
January 8, 2025 - Input such as apple,,orange, creates empty strings. Sometimes that is valid, and sometimes it should be filtered out. ... 1const text = "apple,,orange,"; 2const items = text 3 .split(",") 4 .map(s => s.trim()) 5 .filter(s => s.length > 0); 6console.log(items); ... text = "apple,,orange," items = [part.strip() for part in text.split(",") if part.strip()] print(items) Whether you keep or remove empty values depends on the meaning of the data. Many comma-separated strings really represent numbers or IDs.
Find elsewhere
🌐
Bobby Hadz
bobbyhadz.com › blog › python-convert-comma-separated-string-to-list
Convert a comma-separated String to a List in Python | bobbyhadz
April 9, 2024 - You can use a list comprehension to exclude the empty strings from the list. You can also use the map() function to convert a comma-separated string to a list of integers.
Top answer
1 of 3
1
One would 1st call the string's · split · method: · var list = ' item 1, item 2 , ,item 3 '; · var array = list · .split(','); · gs.debug('\n[' + array.join(']\n[') + ']'); · This prints: · *** Script: [DEBUG] · [ item 1] · [ item 2 ] · [ ] · [item 3 ] · Pretty all over the place. · For better result - where the leading and trailing spaces are removed - one would use · trim · before splitting: · var list = ' item 1, item 2 , ,item 3 '; · var array = list · .trim() · .split(','); · gs.debug('\n[' + array.join(']\n[') + ']'); · *** Script: [DEBUG] · [item 1] · [ item 2 ] · [ ] · [item 3] · Really only slightly better - only the 1st and the last items look good - and half of both only by chance (the one who entered the list did not add extra spaces after the last item and before the 1st one). · To take care of all extra spaces for all items that could exist due to sloppy fellow programmers composing the list or faulty data entry, one would switch the splitter to · RegExp · : · var list = ' item 1, item 2 , ,item 3 '; · var array = list · .trim() · .split(/\s*,\s*/g); · gs.debug('\n[' + array.join(']\n[') + ']'); · *** Script: [DEBUG] · [item 1] · [item 2] · [] · [item 3] · A lot better, almost there, just one problem remains: the 3rd item which is empty. · To take care of that problem one might · filter · the resulting array: · var list = ' item 1, item 2 , ,item 3 '; · var array = list · .trim() · .split(/\s*,\s*/g) · .filter(retainNotEmpty); · function retainNotEmpty (item) { · return '' != item; · } · gs.debug('\n[' + array.join(']\n[') + ']');​ · *** Script: [DEBUG] · [item 1] · [item 2] · [item 3] · Just about what one desires. · Filtering will also fix the issue of empty string ending up (not in a 0 length array, but) in an array with one item when split.
2 of 3
0
Hi @hardikbendre , · Please use the below to convert comma separated value into an array: · // dec stores the comma separated values · var dec = "service,now,community" · var colSplit = dec.split(","); · var arr=[]; · for(i=0;i
🌐
Linux Hint
linuxhint.com › python-list-comma-separated-string
Linux Hint – Linux Hint
April 28, 2023 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
StudyMite
studymite.com › python › converting-a-comma-separated-string-to-a-list-in-python-multiple-approaches
Converting a Comma-Separated String to a List in Python - Multiple Approaches | StudyMite
March 2, 2023 - Converting a Comma-Separated String to a List in Python using split() method, list comprehension and re modules with code and output.
🌐
Andypi
andypi.co.uk › 2016 › 01 › 22 › convert-string-of-comma-separated-values-to-python-list
Convert string of comma separated values to python list – AndyPi
>>> list1 = string1.split(',') >>> print list1 >>> ["bill", "ben", "jack", "james"] ... Comments are closed. Deployment of a Django app on Caddy server using Ansible & Docker · Amiga 500 RGB2HDMI mod plus debugging dead motherboard with ChatGPT · How I started learning Ruby on Rails from scratch as a Python dev (3 – Basic Rails App) How I started learning Ruby on Rails from scratch as a Python dev (2 – Syntax)
🌐
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 can also convert a string to a list using a separator with the split() method. The separator can be any character you specify. The string will separate based on the separator you provide.
🌐
Quora
quora.com › How-do-I-turn-a-comma-separated-string-from-a-file-into-a-list-in-Python-2-7
How to turn a comma separated string from a file into a list in Python 2.7 - Quora
Answer (1 of 2): Open the file, Read the file as a string, Split the string at commas. [code]#open the file, read mode. You need to check the path to the file. #The variable my_csv is an object my_csv = open("path/my_csv.txt","r") #we now deal with the contents of the object, using read. #I a...
🌐
GeeksforGeeks
geeksforgeeks.org › python-convert-list-to-delimiter-separated-string
Convert List to Delimiter Separated String - Python - GeeksforGeeks
February 8, 2025 - In this article, we will check various methods to convert a comma-delimited string to a list in Python.Using str.split()The most straightforward and efficient way to convert a comma-delimited string to a l ... Given string of words separated by some delimiter.
🌐
TutorialsPoint
tutorialspoint.com › How-to-convert-a-Python-csv-string-to-array
How to convert CSV columns to text in Python?
May 7, 2025 - import pandas as pd import io # Sample CSV data csv_data = """Name,Age,Occupation John,32,Engineer Jane,28,Teacher Bob,45,Salesperson""" df = pd.read_csv(io.StringIO(csv_data)) # Convert Name column with different separators name_column = df['Name'].astype(str) print("With comma separator:", ', '.join(name_column)) print("With pipe separator:", ' | '.join(name_column)) print("With newline separator:") print('\n'.join(name_column)) With comma separator: John, Jane, Bob With pipe separator: John | Jane | Bob With newline separator: John Jane Bob · Converting CSV columns to text in Python is straightforward using Pandas.
🌐
IncludeHelp
includehelp.com › python › input-comma-separated-elements-convert-into-list-and-print.aspx
Python | Input comma separated elements, convert into list and print
August 8, 2018 - Convert number (which is in string format) to the integer by using int() method. Print the list. # input comma separated elements as string str = str (input("Enter comma separated integers: ")) print("Input string: ", str) # convert to the list list = str.split (",") print("list: ", list) # ...