擅长:python、mysql、java
<p>不知道你的期望是什么。但是我认为你的列表中有字符串,所以你得到了字符串。试试下面的方法,看看是否有用。你知道吗</p>
<pre><code>#this is all string
#a = ["a\n", "222\n", "bbb\n", "7777"]
#try with the below set
a = [10,11,'1','a','b',12,13,'14','c']
intPart = [x for x in a if isinstance(x, int)]
stringPart = [x for x in a if isinstance(x, str)]
print(intPart)
print(stringPart)
#output
#10, 11, 12, 13]
#['1', 'a', 'b', '14', 'c']
</code></pre>