标签:nbsp 字符 -- int bsp abc pytho 索引 基础
‘‘‘
s = ‘ABCDLSESRF‘
#索引
# s1 = s[0]
# print(s1)
# s2 = s[2]
# print(s2)
# s3 = s[-1]
# print(s3)
# s4 = s[-2]
# print(s4)
# #ABCD 切片 :顾头不顾尾
# s5 = s[0:4]
# print(s5)
# s6 = s[0:-1]
# print(s6)
# s7 = s[:]
# s8 = s[0:]
# print(s7,s8)
# s9 = s[0:0]
s = ‘ABCDLSESRF‘ # s[首:尾:步长]
# s10 = s[0:5:2]
# print(s10)
s11 = s[4:0:-1]
print(s11)
s12 = s[3::-1]
print(s12)
s13 = s[3::-2]
print(s13)
s = ‘ABCDLSESRF‘
s14 = s[-1::-1]
print(s14)
s15 = s[::-1]
print(s15)
‘‘‘
标签:nbsp 字符 -- int bsp abc pytho 索引 基础
原文地址:https://www.cnblogs.com/qingmuzi/p/12578611.html