swapping

Beema shafreen beema.shafreen at gmail.com
Sat Aug 18 07:58:23 CEST 2007


hi everbody,
i have a file with data:
fhl1    fkh2
dfp1    chk1
mal3    alp14
mal3    moe1
mal3    spi1
mal3    bub1
mal3    bub3
mal3    mph1
mal3    mad3
hob1    nak1
i have  written code to check the redudant pairs
my code:
data = []
data1 = []
fh = open('sheet1','r')
for line in fh:
        if line not in data:
                data.append(line)
        else:
                print line


fh.close()
fh1 = open('sheet2','r')
for line1 in fh1:
        if line1 not in data1:
                data1.append(line1)
        else:
                print line1
fh1.close()


result:
klp5    bub1

apn1    apn2

but i have do the same for the revere ,to check the result like this for
eg:
apn2    apn1
what is the concept to do this

regards
shafreen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070818/c85e2d57/attachment.html>


More information about the Python-list mailing list