import res = "abc 123 and 4"res = re.sub(r"\D+", "", s)print(res)
Standard input is empty
1234
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!