python編程快速上手之第10章實踐項目參考答案(12.13.1)
阿新 • • 發佈:2017-05-12
true style span tip 12.1 user python input multi
#! python3 # multiplicationTable.py import openpyxl,os from openpyxl.styles import Font, NamedStyle os.chdir(‘C:\\Users\\Administrator\\Python35-32‘) num=int(input()) wb = openpyxl.Workbook() sheet = wb.get_active_sheet() for n in range(1,num+1): for m in range(1,num+1): sheet.cell(row=1, column=m+1).font=Font(bold=True) sheet.cell(row=1, column=m+1).value=m sheet.cell(row=m+1, column=1).font=Font(bold=True) sheet.cell(row=m+1, column=1).value=m sheet.cell(row=n+1, column=m+1).value = n*m wb.save(‘multiplicationTable.xlsx‘)
python編程快速上手之第10章實踐項目參考答案(12.13.1)