+ 1
How to remove a letter from a string?
Taking into account there are other letters that are the same as that one. Edit: And without a specific letter? Like you want to remove the 2nd letter (with same conditions as before)
3 Antworten
+ 3
s = 'some string'
n = 1 # second character
print(s[:n] + s[n+1:])
+ 5
s = 'letter'
print(s.replace('e', '', 1))
# output: An error occurred. Please check your internet connection and try again.
+ 1
😂😂😂