源代码
import csv
import random
temp = list(range(1, 501))
random.shuffle(temp)
r1 = [temp[i*1:(i+1)1] for i in range(len(temp) //2)]
print(r1)
random.shuffle(temp)
r2 = [temp[i1:(i+1)*1] for i in range(len(temp) //2)]
print(r2)
with open('usedata4.csv',mode ='w+', newline = '', encoding = 'utf-8') as f:
c = csv.writer(f)
c.writerow(['销售额', '广告投入'])
c.writerows(r1)
c.writerows(r2)
谢谢