You aren't getting anything because by default the .split() method splits a sentence up where there are spaces. Since you are trying to split a hyperlink that has no spaces, it is not splitting anything up. What you can do is called a capture using regex. For example:
import re
url = "www.mylocalurl.com/edit/1987"
regex = r'(\d+)'
numbers = re.search(regex, url)
captured = numbers.groups()[0]
If you do not what what regular expressions are, the code is basically saying. Using the regex string defined as r'(\d+)' which basically means capture any digits, search through the url. Then in the captured we have the first captured group which is 1987.
If you don't want to use this, then you can use your .split() method but this time provide a split using / as the separator. For example `url.split('/').
id = [int(i) for i in url if i.isdigit()]url.split()will return the whole url, due to the string not containing any whitespaces. Did you mean to tryurl.split("/")?[int(i) for i in url.split("/") if i.isdigit()]returns[1987]for me though, are you sure that you're not running the old unchanged code?