Do you want something like:
import numpy as np
chain_dict = {}
for line in open('input'):
if line.startswith("ATOM"):
line = line.split()
# get x, y, z coordinates for Cas
chainid = line[4]
atomid = line[2]
pdbresn= line[5]
xyz = [line[6],line[7],line[8]]
if chainid not in chain_dict:
chain_dict[chainid]=[xyz]
else:
chain_dict[chainid].append(xyz)
which, for your example data, gives:
>>> chain_dict
{'A': [['1.285', '-26.367', '7.882'], ['1.719', '-25.217', '8.694'], ['2.599', '-24.279', '7.885'], ['3.573', '-24.716', '7.275'], ['2.469', '-25.791', '9.881']]
and since it's a dictionary, obviously you can do:
>>> chain_dict['A']
[['1.285', '-26.367', '7.882'], ['1.719', '-25.217', '8.694'], ['2.599', '-24.279', '7.885'], ['3.573', '-24.716', '7.275'], ['2.469', '-25.791', '9.881']]
to get just the xyz coords of the chain you're interested in.