clarification

Beema shafreen beema.shafreen at gmail.com
Fri Aug 17 02:32:36 EDT 2007


hi everybody,
i have a file with data separated by tab
mydata:
fhl1    fkh2
dfp1    chk1
mal3    alp14
mal3    moe1
mal3    spi1
mal3    bub1
mal3    bub3
mal3    mph1
mal3    mad3
hob1    nak1
hob1    wsp1
hob1    rad3
cdr2    cdc13
cdr2    cdc2
shows these two are separated by tab represented as columns
i have to check the common data between these two coloumn1 an coloumn2
my code:
data = []
data1 = []
result = []
fh = open('sheet1','r')
for line in fh.readlines():
        splitted = line.strip().split('\t')
        data.append(splitted[0])
        data1.append(splitted[1])
        for k in data:
                if k in data1:
                        result.append(k)
                        print result
fh.close()

can you tell me problem with my script and what should is do for this

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


More information about the Python-list mailing list