I am trying to look up each value from file A and loop it through file B. As i already said that I am new in python programming so this is what I could come up with. And this is the output of an algorithm I use in my research so its not a part of any homework assignment.
On Sat, Sep 17, 2011 at 1:03 AM, Gora Mohanty <g...@mimirtech.com> wrote: > On Sat, Sep 17, 2011 at 9:56 AM, Ananya Sharma <as1...@msstate.edu> wrote: > [...] > > Could you explain the logic that you are trying to use in the code > below, because it is not making much sense. Also, is this a > homework problem? > > > *Script-* > > * > > * > > f1=open('fileA','r') > > f2=open('fileB','r') > > a="" > > b="" > > for n in f1: > > while not b.startswith(n): > > b=f2.readline() > > if len(a)>0: > > print a > > a is always "" above, so len(a) is always zero. > > > b="" > > while not b.startswith(">"): > > a=a+f2.readline()+"__" > [...] > > You just set b to "", so the if conditional is never entered. > > Regards, > Gora > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers