Created
June 10, 2015 07:06
-
-
Save rajasankar/ced8ff44c482cca78fe5 to your computer and use it in GitHub Desktop.
This code to extract only songs not the explanations that comes with.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A=open('file.txt') | |
E=A.readlines() | |
A.close() | |
startcount= #put the linecount here | |
emptyline=0 | |
state=True | |
value=True | |
linevalue=0 | |
i=0 | |
isurai=True | |
for line in range(0,len(E)): | |
p = re.compile(r'\d') | |
if p.match(E[line].replace('.','')) and E[line].replace('.','').find(str(startcount))!=-1: | |
print E[line], | |
if not isurai: | |
break | |
for i in range(1,10,2): | |
if E[line+1+i]=='\n': | |
break | |
if E[line+2+i].startswith(' '): | |
print E[line+1+i].replace(' ','').replace('\n','')+E[line+2+i].replace(' ',''), | |
else: | |
print E[line+i+1].replace(' ','').replace('\n','') | |
print E[line+i+2].replace(' ','').replace('\n','') | |
if i<4: p="">: | |
break | |
startcount=startcount+1 | |
isurai=False | |
print '\n', | |
else: | |
printline='' | |
printline1='' | |
if i==9 or i==5: | |
isurai=True | |
for j in range(i,150): | |
if p.match(E[line+j].replace('.','')) and E[line+j].replace('.','').find(str(startcount))!=-1: | |
break | |
printline=printline+' '+E[line+j].replace('\n',' ').replace(' ','') | |
print printline.strip(),'\n\n', | |
i=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment