How do you know if its a le or a la in french?

Often it's obvious, since it's a living thing and obviously male or female. For objects, you just have to learn the grammatical gender.