I am looking for a way to extract a filename and extension from a particular url using Python
lets say a URL looks as follows
picture_page = \"http://dis
This is the easiest way to find image name and extension using regular expression.
import re
import sys
picture_page = "http://distilleryimage2.instagram.com/da4ca3509a7b11e19e4a12313813ffc0_7.jpg"
regex = re.compile('(.*\/(?P\w+)\.(?P\w+))')
print regex.search(picture_page).group('name')
print regex.search(picture_page).group('ext')