import time import random file = open('225python.txt', 'r', encoding='UTF-8') peopleList=[]; for line in file.readlines(): peopleList.append(line) file.close() seconds = list(i for i in range(1,11)); seconds.reverse() print('抽獎開始 倒數10秒') for i in list(seconds): print(i) time.sleep(1) result=random.sample(peopleList,2); print('恭喜以下兩位:n',result[0],result[1])