(Jun-03-2020, 10:13 AM)buran Wrote:var = 'When parents goWhat do they listen toWhy' words = ['When', 'Why', 'What', 'How'] for word in words: if not var.startswith(word): var = var.replace(word, f'. {word}') print(var)
Thank you so much.
There is one 'but'. For example: if the string has
When parents goWhat do they listen toWhy How
How to do not to set '.' in front of 'How' ?
output:
When parents go. What do they listen to. Why How