让所有奇数都在偶数前面,而且奇数升序排列,偶数降序排序,如字符串'1982376455',变成'1355798642'方法一deffunc1(l):ifisinstance(l,str):l=...
A,B中相同元素:print(set(A)&set(B))A,B中不同元素:print(set(A)^set(B))
list1=[1,2,3]list2=[3,4,5]set1=set(list1)set2=set(list2)print(set1&set2)print(set1^set2)
让所有奇数都在偶数前面,而且奇数升序排列,偶数降序排序,如字符串'1982376455',变成'1355798642'方法一deffunc1(l):ifisinstance(l,str):l=...
A,B中相同元素:print(set(A)&set(B))A,B中不同元素:print(set(A)^set(B))
list1=[1,2,3]list2=[3,4,5]set1=set(list1)set2=set(list2)print(set1&set2)print(set1^set2)