[Tutor] Break outside the loop error (line 23)
Sasi -
loki85 at outlook.com
Sat May 31 11:23:21 CEST 2014
Hi, i tried to make a code to execute the functions that i described below. However i got a break outside the loop error and i have tried to tab and all that but i still get the same error for line 23. I'm using python 2.7
Please help me. I'm completely new to coding (just started last week)Thank you for your time, i have pasted the code below.
## open both filesfile1 = open('human_brain_proteins.csv')file2 = open('human_plasma_proteins.csv')#file1 = open('log1')#file2 = open('log2')
## createdd a counter to count linescount1 = 0count2 = 0
## define 3 lists to be filled in latercommon = list()brain = list()plasma = list()
## Created the lists for brain and plasma before searching for common bioseq.while True: count1 += 1 s1=file1.readline().partition(',')[0]if s1 and count1 > 1: brain.append(s1) if not s1: breakwhile True: count2 += 1 s2=file2.readline().partition(',')[0]if s2 and count2 > 1: plasma.append(s2) if not s2: break
## Compared the lists to find out common bioseq., add the common bioseq. into the common list,## then remove the common bioseq. from both listsfor item1 in brain: for item2 in plasma: if item1 == item2: common.append(item1) brain.remove(item1) plasma.remove(item2)
## closed both filesfile1.close()file2.close()
## print out the listsprint "Common biosequence:"print common,"\n"print "Brain specific biosequence:"print brain,"\n"print "Plasma specific biosequence:"print plasma,"\n"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140531/4a3a5bad/attachment.html>
More information about the Tutor
mailing list