How i can remove letter from the position
string1 = 'BPBPBPPPBPPPPPPBBBBPPBPBPPBPPPPBBPBPPBPBPP'
letter_4 = string1[3]
new_text = re.sub(letter_4,'', string1)
The resault is BBBBBBBBBBBBBBBB
The result I want is to remove only the letter number 4, which is ‘P’
>Solution :
As Carlos Horn said in his comment, to remove a character at index n in a string, you can simply use
st = "Hello there"
n = 6
st = st[:n]+st[n:]
In this case specifically:
string1 = 'BPBPBPPPBPPPPPPBBBBPPBPBPPBPPPPBBPBPPBPBPP'
n = 3
new_text = string1[:n]+string[n+1:]