在这里。
import xlsxwriter
# XLSXWRITER uses O as first row or column
row = 1 # 2nd row... leave room for Headers
col = 0 # 1st column
# Assign Names and Registration Numbers to Contestants
while True:
print("\nEnter q to stop entering names", "\n")
while True:
fname = input("Enter First Name: ")
if fname.isalpha():
break
else:
print("Please ONLY use letters A-Z")
continue
if str(fname) == 'q':
break
while True:
lname = input("Enter Last Name: ")
if lname.isalpha():
break
else:
print("Please ONLY use letters A-Z")
continue
while True:
house = input("Enter House: ")
if house.isalpha():
break
else:
print("Please ONLY use letters A-Z")
continue
dob = input("Enter Date of Birth 'dd/mm/yyyy': ")
while True:
try:
regno = int(input("Enter Registration Number: "))
except ValueError:
print(" That is not a valid number")
continue
else:
break
print("\n")
date = workbook.add_format({'num_format': 'dd/mm/yyyy'})
worksheet.write(row, col, fname) # First Name
worksheet.write(row, col+1, lname) # Last Name
worksheet.write(row, col+2, house) # House
worksheet.write(row, col+3, dob) # Date of Birth
worksheet.write(row, col+4, regno, date) # Reg. No. # 28/02/13
row = row+1