import re url = "www.mylocalurl.com/edit/1987" num = re.sub('\D', '', url) print(num)
Standard input is empty
1987
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!