擅长:python、mysql、java
<p>怎么办:</p>
<pre><code>len(mylist) == 2 and mylist[1] == "comment"
</code></pre>
<p>例如:</p>
<pre><code>>>> mylist = ["important", "comment"]
>>> c = len(mylist) == 2 and mylist[1] == "comment"
>>> c
True
>>>
>>> mylist = ["important"]
>>> c = len(mylist) == 2 and mylist[1] == "comment"
>>> c
False
</code></pre>