+ 1

How to print a list to string?

Input : [ 'a', 'b' ,'c'] Output : abc

22nd Jun 2021, 5:40 AM
Zahed Shaikh
Zahed Shaikh - avatar
3 Respuestas
+ 3
you could also use destructurator operator and sep named argument: print(*['a','b','c'], sep='') this will work even if not all values of list are string ;)
22nd Jun 2021, 5:56 AM
visph
visph - avatar
+ 2
Zahed Shaikh Try this↓ lst=['a','b','c'] Str=''.join(lst) print(Str)
22nd Jun 2021, 5:48 AM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
0
Or try this: for i in Input: print(i,end="")
22nd Jun 2021, 9:28 AM
Angela
Angela - avatar