最近我注意到,当我转换list到set元素的顺序发生变化,由字符排序.
考虑这个例子:
x=[1,2,20,6,210]
print x
# [1, 2, 20, 6, 210] # the order is same as initial order
set(x)
# set([1, 2, 20, 210, 6]) # in the set(x) output order is sorted
Run Code Online (Sandbox Code Playgroud)
我的问题是 -