+ 3
How so you display list objects as a string (python)
How would you make a list such as: [d, o, g] be displayed as: dog if you could post a solution that was for any length of list that would be most helpful. :)
3 Respuestas
+ 16
use ' '.join ([d,o,g])
https://www.tutorialspoint.com/JUMP_LINK__&&__python__&&__JUMP_LINK/string_join.htm
+ 8
The join method as proposed by Yousef is the correct way.
There is another way also.
lis=['d','o','g']
print(*lis,sep='')
print(''.join(lis))
+ 3
Good question, I have never really thought about it and now that I think of it, knowing this could have really helped me in my recent codes.