Home > Article > Backend Development > Python intercepts string
A certain string is stmp="abcdef54321"
Get the first 5 stmp[:5]
Get the next 5 stmp[-5:]
Start from the front, excluding the last two stmp[:- 2]
Get from the 5th to the last stmp[4:]
Get from the 1st to the 2nd stmp[0:2]