How would you use Beautiful soup to get a URL base name in python? Given the url name as a string, what would you do?
I'd use urlparse over BeautifulSoup for extracting pieces of a URL. Here's an example:
from urlparse import urlparse
parsedurl = urlparse('http://example.com/filename.txt')
print parsedurl.path
The output will be:
/filename.txt