Sharing the usage of python string split

高洛峰
Release: 2017-01-18 16:16:48
Original
1587 people have browsed it

For example, our storage format is:

Format:

Name, age|Another user’s name, age

name:haha,age:20| name:python,age:30|name:fef,age:55

Then we can cut the string object into a list through the split method of the string object.

a = 'name:haha,age:20|name:python,age:30|name:fef,age:55'

print a.split('|')

Return results:

['name:haha,age:20', 'name:python,age:30', 'name:fef,age:55']
Through the above Introduction, I believe you have a better understanding of python string split

For more python string split usage sharing related articles, please pay attention to the PHP Chinese website!

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