0

3.1Python基本字符串操作

Posted by 撒得一地 on 2016年1月30日 in python教程

所有标准的序列操作(索引分片乘法求长度、最小值、最大值判断成员资格等)对于字符串同样适用。但是,有一点非常重要的是,字符串都是不可改变的,比如:

>>> str = "hello world!"
>>> str[-6:] = "guest!"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment

上一篇:

下一篇:

相关推荐

发表评论

电子邮件地址不会被公开。 必填项已用*标注

7 + 3 = ?

网站地图|XML地图

Copyright © 2015-2024 技术拉近你我! All rights reserved.
闽ICP备15015576号-1 版权所有©psz.