multipart_upload_8.py 443 B

12345678910111213141516
  1. def split_source_file():
  2. """
  3. 对文件进行分片
  4. :return:
  5. """
  6. part_number = 1
  7. index_list = [0]
  8. while CHUNK_SIZE * part_number < MULTIPART_UPLOAD_FILE_SIZE:
  9. index_list.append(CHUNK_SIZE * part_number)
  10. part_number += 1
  11. if part_number > 10000:
  12. print ("分片数 %s 已超过最大允许分片数 10000,请调整分片大小." % part_number)
  13. sys.exit(-1)
  14. return index_list