beginner in python

Beema shafreen beema.shafreen at gmail.com
Wed Aug 1 23:57:04 EDT 2007


Hi everybody ,
      I am a beginner in python,
         I have to fetch the redundant entries from a file,

code:

import re
L = []
fh = open('ARCHITECTURE_MAIN.txt','r')
for line in fh.readlines():
        data =line.strip()
#       splitted = data.split('#')
        L.append(data)
fh.close()


M=L
for x in L:
        x = x.split('#')
        for y in M:
            y = y.split('#')
        x_data = x[0],x[1],x[2],x[3]
        #print x_data
        y_data = y[0],y[1],y[2],y[3]
        #print y_dat
        if x_data[0] == y_data[0]:
              print x_data


i get the result as a tupule,
the text file which has datas separated by hash
entry#isoform#start#stop#  i have to check upto this

00250_1#ARCH_104#61#89#Literature#9224948#00250####
00250_1#ARCH_104#97#126#Literature#9224948#00250####
00250_1#ARCH_104#139#186#Literature#9224948#00250####
00251_1#ARCH_463#7#59#SMART##00251####
00251_1#ARCH_463#91#121#SMART##00251####
00251_1#ARCH_463#251#414#SMART##00251####
00251_1#ARCH_463#540#624#SMART##00251####
00252_1#ARCH_474#1#21#Literature#8136357#00252####
00252_1#ARCH_393#481#501#Literature#8136357#00252####
00252_1#ARCH_463#523#553#SMART##00252####
00253_1#ARCH_82#37#362#SMART##00253####
00253_1#ARCH_54#365#522#SMART##00253####
00253_1#ARCH_104#589#617#SMART##00253####
00253_1#ARCH_104#619#647#SMART##00253####
00253_1#ARCH_104#684#712#SMART##00253####
00254_1#ARCH_82#27#352#SMART##00254####
00254_1#ARCH_54#355#510#SMART##00254####
00254_1#ARCH_104#576#604#SMART##00254####
00254_1#ARCH_104#606#634#SMART##00254####
00254_1#ARCH_104#671#699#SMART##00254####
00255_1#ARCH_82#56#425#SMART##00255####
00255_1#ARCH_54#428#582#SMART##00255####
00255_1#ARCH_104#696#724#SMART##00255####




can you suggest me ,what are the improvement i have to make in the above
code
regards
shafreen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070802/00a8a0c8/attachment.html>


More information about the Python-list mailing list