an elegant way to concatenate a list of chars in a string in Python

char, concatenation, list, python, string

Solution

This is the usual way of concatenating strings in Python:

''.join(list_of_chars)

In fact, that's the recommended way - for readability and efficiency reasons. For example:

''.join(['h', 'e', 'l', 'l', 'o'])
=> 'hello'

Problem

Possible Duplicate: How can I optimally concat a list of chars to a string? I have a list of chars: ``` ['h', 'e', 'l', 'l', 'o'] ``` Is there a way to concatenate the elements of such list in a string 'hello' that does not require c-like 'for' loop? Thanks.

Original source

Related problems