In music21 you could do this:
from music21 import *
s = converter.parse(filepath)
# assuming key changes are the same in all parts, just get the first part
p = s.parts[0]
pFlat = p.flat
keySigs = pFlat.getElementsByClass('KeySignature')
for k in keySigs:
print k.measureNumber
for the simple case that you're interested in, John K's answer will do great. But if you want to do something more complex (such as determine the current meter at the time of a key change, see if key regions analyze to the same key as the signature, etc.) then music21 could be an aid.
(EDIT: to disclose that I am the producer of the software package).