You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stachulemko edited this page Jan 7, 2023
·
1 revision
Remove a character from string at specific index
strObj = "This is a sample string"
#Let’s remove the character at index 5 in above created string object i.e.
index = 5
# Slice string to remove character at index 5
if len(strObj) > index:
strObj = strObj[0 : index : ] + strObj[index + 1 : :]
Output:
Modified String : This s a sample string