I'm glad they got caught. That will 'teach them a lesson'! [=they will learn that they should not do that again]
We 'learned our lesson' the hard way. [=we learned from an unpleasant experience]
They studied the 'lessons' [='teachings'] of the great philosophers.
(..) Your son, my lady. You truly are a Great One. My son! Look at the lovely little baby. Isn't he wonderful? The Lord has taught me a fine lesson. Though I may think I am godly, I am not worldly. Please. My barbarian friend, let's open a barrel and try to save each other's souls. (..)1991 Robin Hood: Prince of Thieves