Home  >  Article  >  Backend Development  >  Sharing the usage of python string split

Sharing the usage of python string split

高洛峰
高洛峰Original
2017-01-13 16:31:301200browse

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!


Statement:
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