Python字符串截取
super
2022-12-14 23:39
2481
Python字符串截取
str = '123456'
print(str[2])
# 3
print(str[2:])
# 3456
print(str[-2:])
# 56
print(str[0:2])
# 12
print(str[0:-2])
# 1234
print(str[0:5:2])
# 135
0 条讨论