Home > Article > Backend Development > Sharing the usage of python string split
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!