my_list = ['a', 'b', 'c', 'd']
my_string = ','.join(my_list)
'a,b,c,d'
This won’t work if the list contains integers
And if the list contains non-string types (such as integers, floats, bools, None) then do:
my_string = ','.join(map(str, my_list))
More Related Contents:
- What does += mean in this context?
- Most efficient way to build single-element list from string with or without spaces? [closed]
- User input integer list [duplicate]
- Converting a string representation of a list into an actual list object [duplicate]
- Loop “Forgets” to Remove Some Items [duplicate]
- Converting a String to a List of Words?
- String to list in Python
- How can I convert each item in the list to string, for the purpose of joining them? [duplicate]
- Removing a list of characters in string
- Confused about __str__ on list in Python [duplicate]
- How do I convert a list into a string with spaces in Python?
- Perform a string operation for every element in a Python list
- How do I serialize a Python dictionary into a string, and then back to a dictionary?
- How to convert a string of space- and comma- separated numbers into a list of int? [duplicate]
- Change a string of integers separated by spaces to a list of int
- Splitting List That Contains Strings and Integers
- How to convert a string list into an integer in python [duplicate]
- Convert list of strings to dictionary
- Replace special characters in a string in Python
- Sort list of strings by a part of the string
- How to create a list with the characters of a string? [duplicate]
- Python: How to check a string for substrings from a list? [duplicate]
- Convert a columns of string to list in pandas
- How to apply __str__ function when printing a list of objects in Python [duplicate]
- convert a string which is a list into a proper list python
- How to sort a list of strings in reverse order without using reverse=True parameter?
- How to convert list of intable strings to int [duplicate]
- How does str.startswith really work?
- Join a list of strings in python and wrap each string in quotation marks
- Length of longest word in a list