By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Can I general this code to draw a regular polyhedron? main.py. To learn more, see our tips on writing great answers. You can do this in one line for most basic use cases, including the one given in the original question. Which one to choose? How do I count the occurrences of a list item? By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Comma-separated string to list in Python First of all, we will store a comma-separated string in a variable comma_string. Convert string representation of list to list in Python. Thanks for contributing an answer to Stack Overflow! To convert a Python list to a comma-separated string, you will want to use the join () method. Separator characters inside the quotes are ignored. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, @Julien I think you deleted it because it can be directly be a list, instead of a string (and if wanted a string do. Initialize the string to be split, test_str. Per comment below, this is dangerous as it simply runs whatever python is in the string. How to create a virtual ISO file from /dev/sr0. Find centralized, trusted content and collaborate around the technologies you use most. Select a blank cell adjacent to the list's first data, for instance, the cell C1, and type this formula =CONCATENATE (TRANSPOSE (A1:A7)&",") ( A1:A7 is the column you will convert to comma serrated list, "," indicates the separator you want to separate the list). How about saving the world? Effect of a "bad grade" in grad school applications. VASPKIT and SeeK-path recommend different paths. Why can't the change in a crystal structure be due to the rotation of octahedra? Thanks for contributing an answer to Stack Overflow! Beginner kit improvement advice - which lens should I consider? How do I make the first letter of a string uppercase in JavaScript? Why does Acts not mention the deaths of Peter and Paul? How do I merge two dictionaries in a single expression in Python? Can I general this code to draw a regular polyhedron? What does the power set mean in the construction of Von Neumann universe? Lists might contain items of different types, but usually the items all have the same type. What does the power set mean in the construction of Von Neumann universe? When a gnoll vampire assumes its hyena form, do its HP change? Thanks for contributing an answer to Stack Overflow! This should be applicable to lists with any length. How can I convert this string to list of lists? Futuristic/dystopian short story about a man living in a hive society trying to meet his dying mother, Ethical standards in asking a professor for reviewing a finished manuscript and publishing it together. If you have nested lists, it does get a bit more annoying. Find centralized, trusted content and collaborate around the technologies you use most. You can parse and clean up this list as needed using list comprehension. What is Wario dropping at the end of Super Mario Land 2 and why? How do I convert a String to an int in Java? list_of_strings = ["A", "List", "Of", "Strings"]. VASPKIT and SeeK-path recommend different paths. In that case I would suggest looking at the csv module in the standard library: my_list may contain any type of variables. This does not work if you have a list of words that you want to turn to strings, however; Python thinks you are calling variables (e.g. My requirement, bringing me here, was to fill an SQL "WHERE x NOT IN ()" clause. Python, How to convert string representation of list to a list, How to read a text file into a list or an array with Python. I'm guessing plenty has changed with Python since then.