He used to have an untidy appearance. After several failed attempts to ask a girl out, he finally learned his lesson and spruced up his appearance.
learned one's lesson (the hard way)the hard way 就表示親身經歷錯誤而學到乖, 這是正統的美語說法.
他之前往往不修邊幅, 後來經過多次跟女生約會失敗後總算學到教訓, 開始整理自己的儀容了< >
My sister is bad-tempred and would snap at anybody whenever she feels like it.