text = open("c:\\Properties.diff").read() chg = text.count('typeID:') print chg