📜  python 按索引分配字符串 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:18.537000             🧑  作者: Mango

代码示例1
# Strings are immutable in python, so you cannot insert characters.

# You could do convert it to a list however:
  
text = "Hello Warld"

text = list(text)
text[7] = "o"
text = "".join(text)

>>>text
"Hello World"