title: how to remove part of url using python
body: <p>i have this prob i can't figure out a way to do this so I'm asking for  someone to help </p>
  
  <p>i have URL like this 
  <a href="https://abc.xyz/f/b/go_cc_Jpterxvid_avi_mp4" rel="nofollow noreferrer">https://abc.xyz/f/b/go_cc_Jpterxvid_avi_mp4</a>
  and i want to remove the last part of URL and and change /f/ with /d/ so i can get the URL to be like this <a href="https://abc.xyz/d/b" rel="nofollow noreferrer">https://abc.xyz/d/b</a> </p>
  
  <p>keep in mind the prefix /b it change regular
  python
  i have tried this based on ur answer but it didsn't work for me </p>
  
  <p>newurl = oldurl.replace('/f/','/d/').rsplit("/", 1)[0])</p>