How to print string multiple times separated by delimiter - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to print string multiple times separated by delimiter (/thread-27028.html) |
How to print string multiple times separated by delimiter - Mekala - May-23-2020 Hi, Is there any way to print single string multiple tiles in same line and separated by dilimiter: print(*range(5), sep=", ") ## this is working s = 'abcd' print(s*2) ## this is working print((s*2),sep=' and ') ## this is not working RE: How to print string multiple times separated by delimiter - Yoriz - May-23-2020 It is not working because it is one string item s = 'abcd' print(*(s for _ in range(2)), sep=' and ')
|