2007年12月12日 星期三 13:16
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'") 我用什么方法能把这个结果集倒过来呢 ("'071101:0226+1279', 'TSTPEN', 'MAEU', 'UNOA:1','UNB'") 谢谢 -- , ," 1+ /( )`" 1+ \ \___ / |" 1+ /- _ `-/ '" 1+ (/\/ \ \ /\" 1+ / / | ` \" 1+ O O ) / |" 1+ `-^--'`< '" 1+ (_.) _ ) /" 1+ `.___/` /" 1+ `-----' /" 1+ <----. __ / __ \" 1+ <----|====O)))==) \) /====" 1+ <----' `--' `.__,' \" 1+ | |" 1+ \ / /\" 1+ ______( (_ / \______/" 1+ ,' ,-----' |" 1+ `--{__________)"
2007年12月12日 星期三 13:25
2007/12/12, 吕新志 <lvxinzhi在gmail.com>: > 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'") > 我用什么方法能把这个结果集倒过来呢 > > ("'071101:0226+1279', 'TSTPEN', 'MAEU', 'UNOA:1','UNB'") > > 谢谢 >>> 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')
2007年12月14日 星期五 18:38
我常这么用: for x in reversed(...) On 4, xiaq <xiaqqaix at gmail.com> wrote: > 2007/12/12, 吕新志 <lvxinzhi at gmail.com>: > > 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'") > > 我用什么方法能把这个结果集倒过来呢 > > > > ("'071101:0226+1279', 'TSTPEN', 'MAEU', 'UNOA:1','UNB'") > > > > 谢谢 > > >>> 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') > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese
Zeuux © 2024
京ICP备05028076号