#2022.6.1 #by 秦舞阳 import csv import pandas as pd import xlrd2 import xlwt import random import matplotlib.pyplot as plt #显示中文 plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False ls = {} rows = 0 My_label = -1 i = 0 j = 0 a = list(range(0,38)) b = list(range(0,38)) c = list(range(0,38)) d = list(range(0,38)) e = list(range(0,38)) excel_1 = xlrd2.open_workbook(r"20电气2班花名册.xlsx") sheet_1 = excel_1.sheet_by_index(0) excel_3 = xlwt.Workbook(encoding='utf-8') sheet_3 = excel_3.add_sheet('sheet1') pattern = xlwt.Pattern() pattern.pattern = xlwt.Pattern.SOLID_PATTERN pattern.pattern_fore_colour = 1 # 5 背景颜色为黄色 style = xlwt.XFStyle() style.pattern = pattern def birth( ): a = random.randint(1, 12) b = random.randint(1, 30) c = a + b / 100 return c for row in range(sheet_1.nrows)