嗨我正在使用python,我需要知道如何拆分这样的字符串:
" sometext @ aaaa sometext @bbbb sometext @ cccc"
到这个数组:
[' AAAA'' BBBB'' CCCC']
答案 0 :(得分:0)
您可以使用正则表达式:
>>> import re
>>> re.findall(r'@(\w+)', "sometext@aaaa sometext @bbbb sometext@cccc")
['aaaa', 'bbbb', 'cccc']