季定睿python字串方法in找到特定題號和題目
file = open('金融常識.txt','r',encoding='utf-8')
lines = file.readlines()
file.seek(0) #讀完readlines()記憶體指標回到檔案開頭
reading = file.read() #上個星期read()是讀取所有字元
file.close()
total=len(lines)
print(total, len(reading))
x = input('季定睿輸入搜尋關鍵詞,列出所有題目:')
n = 0
for i in range(total): #迴圈使用數字0到503
if x in lines[i]: # if line.find(x) != -1: 使用python更強的功能in
n += 1 # 被更常使用
print(n, '題號',i,lines[i],end="") #預設結束換列
print(f'\n總共{n}題目')
商業軟體期中考。Google找到你的網頁,一定要將網頁標題的亂碼改成有意義的文字。季定睿EXCEL公式FORMULAS。https://dymtdfrudfytuimtyd.blogspot.com/2026/11/excelformulas.html
回覆刪除1018.商業套裝軟體。https://dymtdfrudfytuimtyd.blogspot.com/2026/10/excelvlookupindirectctrl-shift-enter.html
1102.期中考,完整呈現。https://dymtdfrudfytuimtyd.blogspot.com/2026/11/htmlcssjavascriptpython.html
1019. https://dymtdfrudfytuimtyd.blogspot.com/2026/10/pythonreadseek0readlinesinput.html
https://dymtdfrudfytuimtyd.blogspot.com/2026/10/pythonin_0761265442.html
https://dymtdfrudfytuimtyd.blogspot.com/2026/10/pythonin.html?m=1
1012.https://dymtdfrudfytuimtyd.blogspot.com/2026/10/pythonlistset372411251.html