# -*- coding: cp936 -*-
#-------------------------------------------------------------------------------
# Name:        creat_numfile.py
# Purpose:     ´´½¨ÈÎÎñÎļþ
# Author:      luolijun
# Created:     04/08/2014
#-------------------------------------------------------------------------------

import os
import sys
from os.path import join,getsize


#ÐèÒªÉú³ÉµÄºÅÂëÎļþºÅÊ×£¬ºÅÂëλÊýÓÃ0Ìî³ä
num = [12300000000,12400000000,12500000000,12600000000,12700000000,12800000000]
#ºÅÂëÄÚÈÝ£¬Èç¹ûÊDZäÁ¿Ç뽫ÄÚÈÝÐÞ¸ÄΪ£º±äÁ¿1&&±äÁ¿2&&±äÁ¿3
content = 'test'
#ÅäÖÃÎļþÐèÒªµÄ´óС£¬µ¥Î»M
Max_filesize = 45

def Write_File(style,numr,content):
    #styleΪ0±íʾ´¿ºÅÂ룬Ϊ1±íʾºÅÂëÎļþÖлñÈ¡ÄÚÈÝ
    if style == 0:
        filename = str(numr)+'_'+str(Max_filesize)+'KB_´¿ºÅÂë.txt'
        f = open(filename,'a')
        file_size = 0
        while file_size < Max_filesize:
            f.writelines(str(numr)+'\n')
            numr += 1
            file_size = os.path.getsize(filename)/1024/1024
    elif style == 1:
        filename = str(numr)+'_'+str(Max_filesize)+'KB_ºÅÂë´øÄÚÈÝ.txt'
        f = open(filename,'a')       
        file_size = 0
        while file_size < Max_filesize:
            f.writelines(str(numr)+'&&'+content+'\n')
            numr += 1
            file_size = os.path.getsize(filename)/1024/1024
    f.close()

def Create_Number():
    print('~~~~~~~~~~~~~~~~~~~~Óû§µÇ¼ָÒý~~~~~~~~~~~~~~~~~~~~')
    User_style=input('0£º´¿ºÅÂë\n1£ººÅÂë´øÄÚÈÝ\n×¢Ò⣺ÏàÓ¦µÄ²Ù×÷ÇëÊäÈëÏàÓ¦µÄÐòºÅ\nÇëÓû§ÊäÈë²Ù×÷ÐòºÅ£º')
    for number in num:       
        Write_File(User_style,number,content)

Create_Number()