file = open('金融常識.txt','r',encoding='utf-8') lines = file.readlines() file.seek(0) #讀完readlines()記憶體 reading = file.read() #上個星期read()是讀取所有字元 file.close() x = input('金一乙江珈卉輸入搜尋關鍵詞,列出所有題目: ') n =0 for line in lines: if x in line: # if line.find(x) != -1: 使用python更強的功能in n += 1 # 被更常使用 print(n, ' ',line,end="")#預設結束換列 print(f'\n總共{n}題目')
915,商業軟體,記得問老師如何使用pre.江珈.https://changjiahul.blogspot.com/2026/09/excelleftmidrightpythonfind.html
回覆刪除914.金融市場常識測驗順利執行!https://changjiahul.blogspot.com/2026/09/python.html
908商業軟體,貼上圖片。https://changjiahul.blogspot.com/2026/09/excelunicodeunicharpythonordchr.html