早睡早起,方能养生
Sleep early rise early, way to keep healthy

Python字符串截取

super
2022-12-14 23:39
views 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 条讨论
top