在python 中split()使用多符号分割的例子
调用re模块中的split()函数可以用多个符号进行分割
In[1]:importre In[2]:words='我,来。上海?吃?上海菜' In[3]:wordlist=re.split(',|。|?',words) In[4]:print(wordlist) output: ['我','来','上海','吃','上海菜']
以上这篇在python中split()使用多符号分割的例子就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持毛票票。