E D R S I H C RSS
ID
Password
Join
With clothes the new are best, with friends the old are best.

FrontPage FileSpilt

Spilt

import os

_10MB =  1024 * 1024 * 10
count = 1

filesize = os.path.getsize('c://chobocho//data.img')

print filesize

source_file = open('d://chobocho//56MB.z',"rb")

while ( filesize > 0 ) :
    if ( filesize >= _10MB):
        data = source_file.read(_10MB)
        filesize -= _10MB
    else: 
        data = source_file.read(filesize)
        filesize = 0

    target_filename = "target_" + str(count)
    count += 1;

    target_file = open(target_filename, "wb");
    target_file.write("My data!")
    target_file.write(data)
    target_file.close()

source_file.close()

Join

import os

_10MB = 1024 * 1024 * 10

filesize = _10MB
print filesize
count = 1

target_file = open('c://chobocho//data.img',"wb")

while ( 1 ) :
    source_filename = "target_" + str(count)
    filesize = os.path.getsize(source_filename)
    source_file = open(source_filename,"rb")
    source_file.seek(8)
    data = source_file.read(filesize-8)
    count += 1;
    source_file.close()
    target_file.write(data)
    print source_filename
    print filesize

    if ( filesize < _10MB + 8 ):
        break

target_file.close()
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2013-02-17 01:26:54
Processing time 0.2471 sec