Sign up for Free !!
World's first open source developer community with
Ticketing System
I have a list of characters like
a = ['he','ll','o',' ','good','mo','rni','n','g']
I want te final output as
hello goodmorning
could anyone help me???
a = ['he','ll','o',' ','good','mo','rni','n','g'] print(''.join(a)) arr = [23, 10, 12, 5, 13,19] print(''.join(map(str, arr)))
so if you see this by using join() we can convert different characters into a string
If we want to convert the elements of array into a string we use map() function along with join() function
If you check the output of the above code we get:
hello goodmorning 23101251319
>>> a = ['a', 'b', 'c', 'd'] >>> ''.join(a)
Please Login/Register to write your answer !!!
so if you see this by using join() we can convert different characters into a string
If we want to convert the elements of array into a string we use map() function along with join() function
If you check the output of the above code we get: