发布时间:2019-08-29 07:38:30编辑:auto阅读(2402)
python中没有substring的定义,但是有更轻巧的实现,可以通过数组的slice来截取字符串
例如,在java中我们这样截取字符串:
String s = "Hello OutOfMemory.CN";
String small = s.subString(2,4);
而在python中,我们这样实现:
s = "Hello OutOfMemory.CN"
small = s[2:4]
python的用法更简单了。
上一篇: Python中set的用法
下一篇: python中非常好用的数据库管理工具d
50962
50343
40958
37828
32292
29182
28071
22899
22862
21193
1055°
1731°
1419°
1352°
1616°
1443°
2097°
3640°
3569°
2514°