吃一堑,长一智。

A fall into the pit/ a gain in your wit。