擅长:python、mysql、java
<ol>
<li>使用字符串拆分</li>
<li>在拆分之间使用“/”重新联接</li>
</ol>
<pre><code>URL = https://i.nhentai.net/galleries/1545079/1.jpg
# considering https:// as every start
URL = URL[8:]
# splits and excludes last item
new_url = URL.split('/')[:-1]
# re-joins the url
new_url = '/'.join(new_url)
# adds constant start
new_url = 'https://' + new_url
</code></pre>