re split to break a string into components but keeping separators

后端 未结 0 635
清酒与你
清酒与你 2021-01-14 05:24

I want to break a string into components

s = \'Hello [foo] world!\'
re.split(r\'\\[(.*?)\\]\', s)

which gives me

[\'Hello \',          


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题