擅长:python、mysql、java
<p>解决方案是:</p>
<pre><code>while "https" not in user_url and "http" not in user_url:
</code></pre>
<p>但是:</p>
<pre><code>while "http" not in user_url:
</code></pre>
<p>因为<code>http</code>包含在<code>https</code>中。你知道吗</p>
<p>但是,以下情况可以考虑:www.domain.com/http“因为它包含http。因此,您应该使用regex或使用以下命令:</p>
<pre><code>while user_url[:4] != "http":
</code></pre>