import re str = "60I40J10=14X240P432;"pattern = r"\d+[^\d\s]+" print(' '.join(re.findall(pattern, str)))
Standard input is empty
60I 40J 10= 14X 240P 432;
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!