s = 'is2 Thi1s T4est 3a'res = ' '.join(sorted(s.split(), key=lambda x: next(c for c in x if c.isdigit())))print(res)
Standard input is empty
Thi1s is2 3a T4est
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!