I have a file with data like:
1xxy
(1gmh)
[white line]
ahdkfkbbmhkkkkkyllllkkjdttyshhaggdtdyrrrutituy
[white line]
__________________________________________________
Intra Chain:
A 32
__________________________________________________
PAIR 1MNS HE 10 NM A ARG 33 OX1 3.22 32
PAIR 1MNS UR 11 NM A ARG 33 OX2 3.21 12
PAIR IMNS UK 32 NH A ASN 43 OZ1 5.21 22
...
__________________________________________________
NOW i want to make it like:
PAIR 1MNS HE 10 NM A ARG 33 OX1 3.22 32
PAIR 1MNS UR 11 NM A ARG 33 OX2 3.21 12
PAIR IMNS UK 32 NH A ASN 43 OZ1 5.21 22
...
i.e. remove all other characters. i tried using:
inp = open('c:/users/rox/desktop/1UMG.out','r')
for line in inp:
if not line.strip(): # to remove excess whit lines
continue
else:
z = line.strip().replace('\t',' ')
if z.startswith('PAIR'):
print z
inp.close()
but this code is also giving me no output. Can't figure out why z.startswith('PAIR') is not working. But up to the previous line it is going fine.
(r' filename.txt').read()actually works?