regex - How to extract coordinates(lat, lan) from a URL in Python? -


i'm bit lost on how extract coordinates (lat, long) url in python.

always i'll recive url this:

https://www.testweb.com/cordi?ll=41.403781,2.1896&z=17&pll=41.403781,2.1896 

where need extract second set of url (in case: 41.403781,2.1896) say, not first , second set of coords same.

i know, can done regex, i'm not enough on it.

here's how regular expression:

import re m = re.search(r'pll=(\d+\.\d+),(\d+\.\d+)', 'https://www.testweb.com/cordi?ll=41.403781,2.1896&z=17&pll=41.403781,2.1896') print m.groups() 

result: ('41.403781', '2.1896')

you might want @ module urlparse more robust solution.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -