Given a list of characters, merge all of them into a string.
Input : ['g', 'e', 'e', 'k', 's', 'f', 'o', 'r', 'g', 'e', 'e', 'k', 's'] Output : geeksforgeeks Input : ['p', 'r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g'] Output : programming
Method 1 : Traversal of list
Initialize an empty string at the beginning. Traverse in the list of characters, for every index add character to the initial string. After complete traversal, print the string which has been added with every character.
Method 2 : Using join() function
By using join() function in python, all characters in the list can be joined. The syntax is:
str = "" str1 = ( "geeks", "for", "geeks" ) str.join(str1)
The list of characters can be joined easily by initializing str=”” so that there are no spaces in between.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Convert list of strings and characters to list of characters
- Python | Convert List of String List to String List
- Python | Convert a string representation of list into list
- Python | Convert list of string into sorted list of integer
- Count of ungrouped characters after dividing a string into K groups of distinct characters
- Python | Convert list of string to list of list
- Convert a String into a square matrix grid of characters
- Python | Convert a nested list into a flat list
- Python | Convert list of tuples into list
- Python | Convert given list into nested list
- Python | Convert list into list of lists
- Python | Ways to Convert a 3D list into a 2D list
- Python | Split string into list of characters
- Python | Convert string list into multiple cases
- Python program to convert Set into Tuple and Tuple into Set
- Python | Convert list of tuples to list of list
- Transform string str1 into str2 by taking characters from string str3
- Convert the string into palindrome string by changing only one character
- Python | Convert list of numerical string to list of Integers
- Python | Convert string enclosed list to list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet