fork download
  1. def get_name_of_file_part(filename, part):
  2. filename, ext = os.path.splitext(filename)
  3. return '__{}_{}{}_part'.format(filename, part, ext)
  4.  
  5.  
  6. def split_file_to_parts(filename, parts):
  7. part_size = os.path.getsize(filename) / parts
  8. with open(filename, 'rb') as init_file:
  9. for part in range(parts):
  10. with open('%s%s' % (FILE, part), 'wb') as file_part:
  11. file_part.write(init_file.read(part_size))
Success #stdin #stdout 0.02s 8736KB
stdin
Standard input is empty
stdout
Standard output is empty