Bdfy Bdfy - 1 month ago 4
Python Question

How to get server_name from url?

I have ( for example ) a link:

http://10.100.0.178:8134/hds-live/livepkgr/_definst_/liveevent.f4m


How to get server_name (http://10.100.0.178:8134/ ) from this link ? Any standard function ?

Answer

Yes there is.

http://docs.python.org/library/urlparse.html [deprecated]

Updated due to luckydonald's comment

For Python 2

For Python 3

Comments