Okay, I'm quite new to python and I hope you can help me with this problem I have.
I'm having two lists, who correspond to each other. Now I want to sort them both in the same way.
I found a solution to that here on the board: Is it possible to sort two lists(which reference each other) in the exact same way?
My problem is now, that one of my lists are strings with dates. I want to sort chronological, but i can't figure ou how to use a key parameter proberly. Here is the code I have:
daten = ["03. Aug 2012", "30. Jul 2012", "25. Jul 2012"]
werte = [10, 35, 22]
daten, werte = (list(t) for t in zip(*sorted(zip(daten, werte), key=lambda x: datetime.datetime.strptime(x[1], "%d. %b %Y"))))
Now I get a TypeError: must be string, not int