EMC ROY wrote:
> Original Sentence: An apple for you.
> Present:           An<AT0> apple<NN1> for<PRP> you<PNP> .<.>
> Desire:            <AT0>An <NN1>apple <PRP>for <PNP>you <.>.

>>> text = 'An<AT0> apple<NN1> for<PRP> you<PNP> .<.>'
>>> import re
>>> re.sub(r'(\S+)(<[^>]+>)(\s*)', r'\2\1\3', text)
'<AT0>An <NN1>apple <PRP>for <PNP>you <.>.'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to