码迷,mamicode.com
首页 > 编程语言 > 详细

Python中同时用多个分隔符分割字符串的问题

时间:2014-10-20 11:40:37      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   sp   div   on   问题   log   

使用正则表达式可以很好解决

import re
s = ‘Hello!This?Is!What?I!Want‘
ss = re.split(‘[!?]‘, s) 
ss = [‘Hello‘, ‘This‘, ‘Is‘, ‘What‘, ‘I‘, ‘Want‘]

 

Python中同时用多个分隔符分割字符串的问题

标签:style   blog   color   使用   sp   div   on   问题   log   

原文地址:http://www.cnblogs.com/arhatlohan/p/4036729.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!