Quantcast
Channel: How can I split a URL string up into separate parts in Python? - Stack Overflow
Browsing all 7 articles
Browse latest View live

Answer by Mayank Jaiswal for How can I split a URL string up into separate...

You can use Python's library furl:f = furl.furl("http://example.com/random/folder/path.html")print(str(f.path)) # '/random/folder/path.html'print(str(f.path).split("/")) # ['', 'random', 'folder',...

View Article



Answer by Abbafei for How can I split a URL string up into separate parts in...

It seems like the posixpath module mentioned in sykora's answer is not available in my Python setup (Python 2.7.3).As per this article, it seems that the "proper" way to do this would be...

View Article

Answer by sykora for How can I split a URL string up into separate parts in...

The urlparse module in Python 2.x (or urllib.parse in Python 3.x) would be the way to do it.>>> from urllib.parse import urlparse>>> url =...

View Article

Answer by Mike Hamer for How can I split a URL string up into separate parts...

If this is the extent of your URL parsing, Python's inbuilt rpartition will do the job:>>> URL = "http://example.com/random/folder/path.html">>> Segments =...

View Article

Answer by Paul Stephenson for How can I split a URL string up into separate...

In Python, a lot of operations are done using lists. The urlparse module mentioned by Sebasian Dietz may well solve your specific problem, but if you're generally interested in Pythonic ways to find...

View Article


Answer by Sebastian Dietz for How can I split a URL string up into separate...

I have no experience with Python, but I found the urlparse module, which should do the job.

View Article

How can I split a URL string up into separate parts in Python?

I decided that I'll learn Python tonight :)I know C pretty well (wrote an OS in it), so I'm not a noob in programming, so everything in Python seems pretty easy, but I don't know how to solve this...

View Article
Browsing all 7 articles
Browse latest View live




Latest Images