Vlad Balanescu
Vlad Balanescu

Reputation: 674

Form list of strings from list of chars in Python

I have a list of chars, something like

['t','u','p','l','e']

and I want to create a list of Strings out of it:

['tuple'

I tried to initialise an empty array and append or += to it but this still returns a list of chars. How can I concatenate strings?

Upvotes: 1

Views: 134

Answers (1)

Vishnu Upadhyay
Vishnu Upadhyay

Reputation: 5061

All you need to join.

In [33]: [''.join(['t','u','p','l','e'])]
Out[33]: ['tuple']

Upvotes: 5

Related Questions