使用正则表达式在字符串中多次拆分(multiple split in string using regex)

编程入门 行业动态 更新时间:2024-10-22 15:33:44
使用正则表达式在字符串中多次拆分(multiple split in string using regex)

我有一个字符串:

Station Disconnect:1.3.6.1.4.1.11.2.14.11.15.2.75.3.2.0.8 StaMAC:00:9F:0B:00:38:B8 BSSID:00 9F Radioid:2

我想拆分这个字符串。 它看起来像这样 -

'Station Disconnect:1.3.6.1.4.1.11.2.14.11.15.2.75.3.2.0.8' 'StaMAC:00:9F:0B:00:38:B8' 'BSSID:00 9F' 'Radioid:2'

我尝试了这个逻辑 - msgRegex = re.compile('[\ w \ s] +:')和split函数。 我该怎么办请帮帮我谢谢

I have a string :

Station Disconnect:1.3.6.1.4.1.11.2.14.11.15.2.75.3.2.0.8 StaMAC:00:9F:0B:00:38:B8 BSSID:00 9F Radioid:2

I want split this string. It look like this -

'Station Disconnect:1.3.6.1.4.1.11.2.14.11.15.2.75.3.2.0.8' 'StaMAC:00:9F:0B:00:38:B8' 'BSSID:00 9F' 'Radioid:2'

I tried this logic - msgRegex = re.compile('[\w\s]+:') and split function also. How can I do Please help me Thank you

更多推荐

本文发布于:2023-08-06 15:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1450357.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   正则表达式   multiple   regex   string

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!