import re print(re.sub(r'000([1-9]|$)', r' \1', '76000123000100000101000').strip())
Standard input is empty
76 123 100 101
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!