我有一个关于排序的简单问题。我有一个像这样的复数的二维数组
[[(-110.61040004379576-17.354473737234287j), (634.2701711342786+20.835585013392976j)],
[(-56.513088619798417+19.304564206160592j), (139.27388305766863+22.035225424174627j)],
[(-56.107824445301581-15.926033069760162j), (139.59169287146287+21.499544204724476j)],
[(45.747228005094165-13.96425461096984j), (92.707153363055141-12.92524051712571j)],
[(-111.22348501455198-15.926033038872692j), (84.47603226469721+21.499544215863018j)],
[(45.747228023236914-13.964254617324347j), (92.707153338674217-12.925240518653737j)],
[(-56.107824379236632-15.926033025484159j), (139.59169284624946+21.499544241697734j)],
[(-111.62498538487328-18.53021375196538j), (138.66271112979905+18.818585903566003j)],
[(-56.107824363639025-15.926033025268273j), (139.59169284605719+21.499544250473367j)],
[(45.747228053266504-13.964254607367101j), (92.707153308435764-12.925240545154857j)]]
我想根据第一个复数的实部对其进行排序。我试过了,
.sort(key=lambda x: x[0].real)
但它没有回答。有什么好主意吗?感谢您的帮助。
R。