import sys ffile = sys.argv[1] amino = ["alanine", "arginine", "asparagine", "aspartic", "cysteine", "glutamic", "glutamine", "glycine", "histidine", "isoleucine", "leucine", "lysine", "methionine", "phenylalanine", "proline", "serine", "threonine", "tryptophan", "tyrosine", "valine"] c = 0 r = "" with open(ffile, mode="r") as inn: for line in inn: if line == "CC -!- CATALYTIC ACTIVITY:\n": r = inn.readline()[:-1] line = inn.readline() while line[0:9] == "CC ": line = inn.readline() r += line[10:-1] for acid in amino: if acid in r: c += 1 r = "" r = "" print(c)