Code:
f = open("centaur_1.mpg","rb")
#create a for loop and split file into 20 parts
buffer=f.read() # readinto a large buffer to check its size
#f.close() #close the file
filesize=len(buffer)
print filesize
splitsize=int(filesize/segmentsize)
f.seek(0) # reset to beginning of file
#smallfbuf=[]
for i in range(splitsize+1):
filename="part"+str(i)+".mpg"
f2= open(filename,"wb")
buffer2 = f.read(splitsize)
f2.write(buffer2)
f2.close()
f.close()
from the above codes, how do i get the filesize and the user to input segmentsize
Comment