Python intercepts string

巴扎黑
Release: 2016-11-26 11:56:21
Original
1249 people have browsed it

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]


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template