1.python字符串为不可变类型 倘若想更改某个字符串常规的方法只能重新生成新的对象代替原字符串 好在Python的io模块有个函数可以使字符串为可变字符串
import io str1 hello world sio io.StringIO(str1) _io.StringIO object at 0x039B0EC8 sio.getvalue() hello world id(str1) 60541032 sio.seek(5) sio.write( - ) sio.getvalue() hello-world id(str1) 60541032
2.Python学习交流或者想要学习资料可以找我WeChat (it5101)



