有没有办法替换字符串中的字符?

时间:2019-01-31 17:16:43

标签: python

我正在尝试替换字符串中的字符。你该怎么做?

这用于一串符号,例如:#+ / 084&“(包括引号)

for word in words:
    for letter in word:
        if letter == "#":
            word[word.index("#")] = "A"

我希望最终结果是该单词另存为A + / 084&“,但出现错误“ str”对象不支持项目分配。

0 个答案:

没有答案