from random import randint string = 'Hello world. Hello world.' for char in ['!','-','=','~','|']: pos = randint(0, len(string) - 1) # pick random position to insert char string = "".join((string[:pos], char, string[pos:])) # insert char at pos print(string)