import random
import xlrd
ExcelFile = xlrd.open_workbook(r'test.xlsx')
sheet = ExcelFile.sheet_by_name('Sheet1')
i = []
x = input("請輸入具體事件:")
y = int(input("老師要求的字數:"))
while len(str(i)) < y * 1.2:
s = random.randint(1, 60)
rows = sheet.row_values(s)
i.append(*rows)
print(" "*8+"檢討書"+"\n"+"老師:")
print("我不應該" + str(x)+",", *i)
print("再次請老師原諒!")
uj5u.com熱心網友回復:
根據你的代碼,print("我不應該" + str(x)+",", *i)改成
print("我不應該" + str(x)+",", i)試試
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
之后變成這樣,謝謝你。uj5u.com熱心網友回復:
len(str(i)) -->len(i)rows=....
i.append...這兩行與s=....左對齊
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/33151.html
