我实际代码中的列表太大了 有没有办法获得所需的输出 一种有效的方式将是首选 这是我的代码:
import sys
def function():
listt=["the","cat","sat","on","the","mat","which","is","on","the","floor"]
print (sorted(set(listt)))
function()
Output:['cat', 'floor', 'is', 'mat', 'on', 'sat', 'the', 'which']
Expected Output:["the","cat","sat","on","mat","which","is","floor"]