import time def creatfilesize(n): local_time = time.strftime("%Y%m%d%H%M%S",time.localtime()) file_name = r"D:\data\test\\" +str(local_time)+".txt" bigFile= open(file_name, 'w') bigFile.seek(1024*1024*1024*n) bigFile.write('test') #bigFile.write("test") bigFile.close() print("ALL down !") def main(): n = 1 #生成1G大小的文件 creatfilesize(n)