Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- f=open("gallerycount.txt","r")
- mp4=open("mp4.txt","w")
- png=open("png.txt","w")
- jpg=open("jpg.txt","w")
- jpeg=open("jpeg.txt","w")
- mov=open("mov.txt","w")
- gif=open("gif.txt","w")
- other_lines=open('other_lines.txt','w')
- i = True
- # i is the raw line reading - as long as it's not empty, the loop should continue
- # l is the text without indentation (stripped) - since strip takes out
- # newlines, I need to have them separate, to prevent the loop from stopping
- # because of an empty stripped newline
- line_counter = 0
- while i != "":
- line_counter += 1
- i=f.readline()
- l=i.strip()
- if l[-3:] == "MP4":
- mp4.write(l+"\n")
- elif l[-3:] == 'PNG':
- png.write(l+"\n")
- elif l[-3:] == 'JPG':
- jpg.write(l+"\n")
- elif l[-4:] == 'JPEG':
- jpeg.write(l+"\n")
- elif l[-3:] == 'MOV':
- mov.write(l+"\n")
- elif l[-3:] == 'GIF':
- gif.write(l+"\n")
- else:
- other_lines.write(l+"\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement