Python: Delete a character from a string -
i want delete i.e. character number 5 in string. did:
del line[5]
and got: typeerror: 'str' object doesn't support item deletion
so no wonder whether there different efficient solution problem.
strings immutable in python, can't change them in-place.
but of course can assign combination of string slices same identifier:
mystr = mystr[:5] + mystr[6:]
Comments
Post a Comment