Is it a button or a push lock? I have button locks in our doors, with just a little hole, and found that NOT the smallest paperclips but the bigger ones work well. (Little ones are a little too flimsy and kind of bend and give, but the larger ones work fine---we keep a few around. Just unfold the first straight part and stick it in straight and push it back open. It took Jeremy a lot of jiggling to figure it out; I have "the touch" and can pop it open on the first try, but it came with practice. I would suggest flipping the doorknobs temporarily (my 5 year old NEVER had an issue with locking the doors, but my 2 year old does it everytime he's mad at me: if I say no he must have water, not juice, (or pick up his mess in the living room, or it's time for bed, etc) he goes to his room and locks it. So, 2 weeks ago we just took the doorknobs off and flipped them so that he can't lock the door from inside.
And yes, if worse came to worse others have mentioned the credit card (don't let it be the one you use all the time because you don't want to risk it cracking), the removing it from the hinges, and of course, easier than the hinges would be removing the doorknob. And worst case scenario, you can indeed call the non-emergency police or fireman lines.
When my son was 18-22 months old, the door opened to the inside of the room. We KEPT it open by putting the train table against it.
I DO suggest that you have a couple copies of the keys with you so he doesn't lock you out of the house. When they were just getting tall enough to reach the entry door knobs, we knew it would happen suddenly when they could lock the doors, so we have a spare key in the cabinet of our garage in case he locks us in while we're bringing in groceries or whatever, and we also have a spare one hidden outside in case he locks us out of the house altogether.
I used to let my oldest play with my keys to keep him happy while I was getting him in the carseat and situated. One day when he was about 8 months old, we were on a road trip in the middle of nowhere, and stopped at McDonalds for a super fast bathroom / diaper break, got a coke, and went back to the car. He was warmly dressed, with his little cap on, but I was in in a T-shirt because I didn't feel like putting my coat on and off. It was drizzling, in the low 50s, so I was in a hurry. I put him in his seat, closed the door while moving to the back to get the map, and heard the car alarm chirp. He pushed the fob button and locked my car, with him in it! I tried to show him how to push the other button, but he just waved, rattled the keys, and drank his bottle. I didn't know what to do....I didn't want to break a window and then it be cold and rainy in my car all the way home (like 8 hours to go). I was scared to leave him but then realized he was obviously safe so I went inside to use their phone (my phone was on the charger). I guess I must have looked terrified because I didn't say anything, but she interrupted a man's order to ask what I needed. I told her what was up and she called the non-emergency line for the police and told them an infant was in the car and said the number is taped to the phone because stuff like that happens often. I sat there shivering and near tears, smiling and waving and tapping the window, making faces, but very upset. He had no idea and smiled, laughed, and started nodding off to sleep in his warm seat with his blanky. The police couldn't get it open, but a locksmith heard the call on the scanner and came by just to see (thank goodness!). They marveled at how happy the baby was (he thought we were all playing with him) and the locksmith popped it open in about 1 minute. He also didn't let me pay---he said he thought my standing in my short sleeves and my "mom guilt" was enough. I n e v e r let him use my keys again!