python自动导出数据脚本_数据生成python脚本

#-*- coding:utf-8 -*-

'''@auther: Starry

@file: prodData.py

@time: 2018/1/17 15:47'''

importrandomimportos

DATASIZE= 10

'''每个数据一组数据'''

for i inrange(DATASIZE):print('The %dth set of test data is being produced.' %i)

with open('./data/test'+str(i)+'.in','w',encoding='utf-8') as f:

N= random.randint(1, 100000)

M= random.randint(1, 100000)

f.write(str(N)+' '+str(M)+'\n')for j inrange(M):

a= random.randint(1,10000)

b= random.randint(1,10000)

c= random.randint(1,200)

f.write(str(a)+' '+str(b)+' '+str(c)+'\n')

with open('./data/test'+str(i)+'.out','w',encoding='utf-8') as f:passos.system('g++ -std=c++11 main.cpp -o main')

os.system('main < data\\test'+str(i)+'.in >> data\\test'+str(i)+'.out')'''多组数据 0 结束'''

#for i in range(DATASIZE):#print('The %dth set of test data is being produced.'%i)#with open('./data/test'+str(i)+'.in','w',encoding='utf-8') as f:#while True:#N = random.randint(-70,1000)#if N <= 0:#f.write(str(0)+'\n')#break#f.write(str(N)+'\n')#for j in range(N):#a = random.randint(1,50)#f.write(str(a)+' ')#f.write('\n')#M = random.randint(0,1000)#f.write(str(M)+'\n')#with open('./data/test'+str(i)+'.out','w',encoding='utf-8') as f:#pass#os.system('g++ -std=c++11 main.cpp -o main')#os.system('main < data\\test'+str(i)+'.in >> data\\test'+str(i)+'.out')

'''多组数据'''

#for i in range(DATASIZE):#print('The %dth set of test data is being produced.' % i)#with open('./data/test'+str(i)+'.in','w',encoding='utf-8') as f:#for j in range(random.randint(1,20)):#N = random.randint(1, 100)#M = random.randint(1, 100)#K = random.randint(1, 100)#S = random.randint(1, 100)#f.write(str(N)+' '+str(M)+' '+str(K)+' '+str(S)+'\n')#for k in range(K):#a = random.randint(1,20)#b = random.randint(1,20)#f.write(str(a)+' '+str(b)+'\n')#with open('./data/test'+str(i)+'.out','w',encoding='utf-8') as f:#pass#os.system('g++ -std=c++11 main.cpp -o main')#os.system('main < data\\test'+str(i)+'.in >> data\\test'+str(i)+'.out')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值