import reresult = re.sub(r"(\d+)(\s+)(apples)", r"\3\2\1", "Look 30 apples.")print(result)
Standard input is empty
Look apples 30.
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!