1

This is the url that I have https://math.berkeley.edu/~jcalder/126F15/hw1.pdf and I want to get only hw1.pdf of that url.

And, I have used urlparse.urlparse(url).path in the library urlparse and it returned ~jcalder/126F15/hw1.pdf which is not what I wanted.

Hence, can anyone show me how to do it please ?

Ozgur Vatansever
  • 49,246
  • 17
  • 84
  • 119
Alexander
  • 282
  • 1
  • 4
  • 13

1 Answers1

1
urlparse.urlparse(url).path.rsplit("/", 1)[-1]
Ozgur Vatansever
  • 49,246
  • 17
  • 84
  • 119