>>> import re
>>> rt = re.compile('^(UNB)\+(UNOA:1)\+(MAEU)\+([\w]*)\+(.*)')
>>> rt.search('UNB+UNOA:1+MAEU+TSTPEN+071101:0226+1279\'').groups()
('UNB', 'UNOA:1', 'MAEU', 'TSTPEN', "071101:0226+1279'")
>>> rt.search('UNB+UNOA:1+MAEU+TSTPEN+071101:0226+1279\'').groups()[::-1]
("071101:0226+1279'", 'TSTPEN', 'MAEU', 'UNOA:1', 'UNB')
阅读(2071) | 评论(0) | 转发(0) |