import csv csvfile = open("mdata.csv", "w+") try: writer = csv.writer(csvfile) for zj in range(1, 501): for cd in range(1, 2001): if (zj<=10 and cd<=100): writer.writerow((zj,cd,0.8,0.2)) elif (zj<=10 and cd>100 and cd<=250): writer.writerow((zj,cd,0.9,0.2)) elif (zj<=10 and cd>250 and cd<=500): writer.writerow((zj,cd,1,0.3)) elif( zj<=10 and cd>500 and cd<=800): writer.writerow((zj,cd,0,0)) elif (zj<=10 and cd>800 and cd<=1200): writer.writerow((zj,cd,0,0)) elif (zj<=10 and cd>1200 and cd<=2000): writer.writerow((zj,cd,0,0)) elif (zj>10 and zj<=18 and cd<=100): writer.writerow((zj,cd,0.9,0.2)) elif (zj>10 and zj<=18 and cd>100 and cd<=250): writer.writerow((zj,cd,0.9,0.3)) elif (zj>10 and zj<=18 and cd>250 and cd<=500): writer.writerow((zj,cd,1,0.3)) elif(zj>10 and zj<=18 and cd>500 and cd<=800): writer.writerow((zj,cd,1.1,0.3)) elif (zj>10 and zj<=18 and cd>800 and cd<=1200): writer.writerow((zj,cd,0,0)) elif(zj>10 and zj<=18 and cd>1200 and cd<=2000): writer.writerow((zj,cd,0,0)) elif (zj>18 and zj<=30 and cd<=100): writer.writerow((zj,cd,1,0.3)) elif (zj>18 and zj<=30 and cd>100 and cd<=250): writer.writerow((zj,cd,1,0.3)) elif (zj>18 and zj<=30 and cd>250 and cd<=500): writer.writerow((zj,cd,1.1,0.3)) elif (zj>18 and zj<=30 and cd>500 and cd<=800): writer.writerow((zj,cd,1.3,0.4)) elif (zj>18 and zj<=30 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.4,0.4)) elif (zj>18 and zj<=30 and cd>1200 and cd<=2000): writer.writerow((zj,cd,0,0)) elif (zj>30 and zj<=50 and cd<=100): writer.writerow((zj,cd,1.1,0.3)) elif (zj>30 and zj<=50 and cd>100 and cd<=250): writer.writerow((zj,cd,1,0.3)) elif (zj>30 and zj<=50 and cd>250 and cd<=500): writer.writerow((zj,cd,1.1,0.4)) elif (zj>30 and zj<=50 and cd>500 and cd<=800): writer.writerow((zj,cd,1.3,0.5)) elif (zj>30 and zj<=50 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.5,0.6)) elif (zj>30 and zj<=50 and cd>1200 and cd<=2000): writer.writerow((zj,cd,1.7,0.6)) elif (zj>50 and zj<=80 and cd<=100): writer.writerow((zj,cd,1.1,0.3)) elif (zj>50 and zj<=80 and cd>100 and cd<=250): writer.writerow((zj,cd,1.1,0.4)) elif (zj>50 and zj<=80 and cd>250 and cd<=500): writer.writerow((zj,cd,1.2,0.4)) elif (zj>50 and zj<=80 and cd>500 and cd<=800): writer.writerow((zj,cd,1.4,0.5)) elif (zj>50 and zj<=80 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.6,0.6)) elif (zj>50 and zj<=80 and cd>1200 and cd<=2000): writer.writerow((zj,cd,1.8,0.7)) elif (zj>80 and zj<=120 and cd<=100): writer.writerow((zj,cd,1.1,0.4)) elif (zj>80 and zj<=120 and cd>100 and cd<=250): writer.writerow((zj,cd,1.2,0.4)) elif (zj>80 and zj<=120 and cd>250 and cd<=500): writer.writerow((zj,cd,1.2,0.5)) elif (zj>80 and zj<=120 and cd>500 and cd<=800): writer.writerow((zj,cd,1.4,0.5)) elif (zj>80 and zj<=120 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.6,0.6)) elif (zj>80 and zj<=120 and cd>1200 and cd<=2000): writer.writerow((zj,cd,1.9,0.7)) elif (zj>120 and zj<=180 and cd<=100): writer.writerow((zj,cd,1.2,0.5)) elif (zj>120 and zj<=180 and cd>100 and cd<=250): writer.writerow((zj,cd,1.2,0.5)) elif (zj>120 and zj<=180 and cd>250 and cd<=500): writer.writerow((zj,cd,1.3,0.6)) elif (zj>120 and zj<=180 and cd>500 and cd<=800): writer.writerow((zj,cd,1.5,0.6)) elif (zj>120 and zj<=180 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.7,0.7)) elif (zj>120 and zj<=180 and cd>1200 and cd<=2000): writer.writerow((zj,cd,2,0.8)) elif (zj>260 and zj<=360 and cd<=100): writer.writerow((zj,cd,1.3,0.6)) elif (zj>260 and zj<=360 and cd>100 and cd<=250): writer.writerow((zj,cd,1.4,0.6)) elif (zj>260 and zj<=360 and cd>250 and cd<=500): writer.writerow((zj,cd,1.5,0.7)) elif (zj>260 and zj<=360 and cd>500 and cd<=800): writer.writerow((zj,cd,1.7,0.7)) elif (zj>260 and zj<=360 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.9,0.8)) elif (zj>260 and zj<=360 and cd>1200 and cd<=2000): writer.writerow((zj,cd,2.1,0.9)) elif (zj>360 and zj<=500 and cd<=100): writer.writerow((zj,cd,1.4,0.7)) elif (zj>360 and zj<=500 and cd>100 and cd<=250): writer.writerow((zj,cd,1.5,0.7)) elif (zj>360 and zj<=500 and cd>250 and cd<=500): writer.writerow((zj,cd,1.5,0.8)) elif (zj>360 and zj<=500 and cd>500 and cd<=800): writer.writerow((zj,cd,1.7,0.8)) elif (zj>360 and zj<=500 and cd>800 and cd<=1200): writer.writerow((zj,cd,1.9,0.9)) else: writer.writerow((zj,cd,2.2,1)) except IOError as e: print(e) finally: csvfile.close()
微信扫码关注
更新实时通知