how to add substring python code example
Example 1: insert into string python
def insert (source_str, insert_str, pos):
return source_str[:pos]+insert_str+source_str[pos:]
Example 2: add place in certain index python string
>>> hash = '355879ACB6'
>>> hashlist = list(hash)
>>> hashlist.insert(4, '-')
>>> ''.join(hashlist)
'3558-79ACB6'