programming-examples/python/Regular_Expression/Extract year, month and date from an url.py
2019-11-15 12:59:38 +01:00

5 lines
289 B
Python

import re
def extract_date(url):
return re.findall(r'/(\d{4})/(\d{1,2})/(\d{1,2})/', url)
url1= "https://www.washingtonpost.com/news/football-insider/wp/2016/09/02/odell-beckhams-fame-rests-on-one-stupid-little-ball-josh-norman-tells-author/"
print(extract_date(url1))