Python program to convert char list to a string














































Python program to convert char list to a string



Our aim to convert list of char to string. 
For example : char_list=['a','b','c','d','e']  to char_list='abcde'
There are two ways of doing it.

1. For loop: 



In above program the for loop will iterate through each char in the char_list and then add the value into char_to_string. This will give all the char in the char_list into string that will be stored in char_to_list variable.

2. Using join()

 
This is one line solution for converting any list of characters into string as shown in the above code. The join() has multiple conversion purpose mainly for strings. Syntax is explained in comment.  





Comments