[(946871.62999999884, [303.91000000000003]), (964918.62999999884, [353.75]),
(965117.81999999878, [356.98000000000002]), (959944.86999999883, [528.53999999999996])]
I have a list that looks like this. I was wondering if there was any way to remove the minilist, so that it would look like
[(94开发者_JAVA百科6871.62999999884, 303.91000000000003), (964918.62999999884, 353.75),
(965117.81999999878, 356.98000000000002), (959944.86999999883, 528.53999999999996)]
Thanks for the help!
Use a list comprehension.
L = [(x, y[0]) for x, y in L]
This should do that:
newList = [(x, y[0]) for x, y in oldList]
精彩评论