-
Notifications
You must be signed in to change notification settings - Fork 0
python string
stachulemko edited this page Jan 7, 2023
·
1 revision
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