programming-examples/python/String/Python function to insert a string in the middle of a string.py
2019-11-15 12:59:38 +01:00

6 lines
218 B
Python

def insert_sting_middle(str, word):
return str[:2] + word + str[2:]
print(insert_sting_middle('[[]]', 'Python'))
print(insert_sting_middle('{{}}', 'PHP'))
print(insert_sting_middle('<<>>', 'HTML'))