In Python, I am trying to sort by date with lambda. I can\'t understand my error message. The message is:
() takes exactly 1 argument (2 given
lst = [('candy','30','100'), ('apple','10','200'), ('baby','20','300')] lst.sort(key=lambda x:x[1]) print(lst)
It will print as following:
[('apple', '10', '200'), ('baby', '20', '300'), ('candy', '30', '100')]