python 公共方法汇总解析
1.计算长度 value = wangdianchao # 计算字符个数(长度) number = len(value) print(number) 2.索引取值 value = wangdianchao # 获取value“0”位置的字符 number = value[0] print(number) value = wangdianchao # 获取value右侧第一个的字符 number = value[-1] print(number) 3.切片 value = wangdianchao # 2<=索引位置<3 number = value[2:4] print(
用户评论