方式一:
b=[1,2,3,4]
c=[x for x in b if x%2 == 0]
a=[x for x in b if x%2 != 0]
c.extend(a)
print(c)


方式二:
L = [1, 2, 3, 4, 5, 6]
index = 0
for _ in range(len(L)):
if L[index] % 2 == 1:
index += 1
else:
L.append(L.pop(index))
print(L)

相关文章:

  • 2021-05-09
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-03-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-11-08
  • 2021-08-25
  • 2022-12-23
相关资源
相似解决方案