beginner in python

km srikrishnamohan at gmail.com
Thu Aug 2 14:13:27 CEST 2007


Hi

pls redefine ur problem.
I donot understand what u wanted to accomplish .
is it that u wanted to check and represent the redundant entry numbers as
one entry or is it
 with the isoform id as a single entry and without considering other data
like start  and stop ?

also observe that when u consider the whole line in the data file, they are
all unique - there is no redundancy.

KM
-----------------------------------------------------------
On 8/2/07, Beema shafreen <beema.shafreen at gmail.com> wrote:
>
> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070802/6801ca9a/attachment.html>


More information about the Python-list mailing list