更新时间:2023-11-07 10:04:58
问题是您对replace
的结果没有执行任何操作.在Python中,字符串是不可变的,因此任何处理字符串的操作都将返回新字符串,而不是修改原始字符串.
The problem is you're not doing anything with the result of replace
. In Python strings are immutable so anything that manipulates a string returns a new string instead of modifying the original string.
line[8] = line[8].replace(letter, "")