蕭中和python方法readseek(0) readlines()li

file = open('金融常識.txt', 'r', encoding='utf-8')
lines = file.readlines()
reading = file.read()
file.close()
x = input('討厭鬼輸入搜尋關鍵詞,列出所有題目:')
n = 0
for line in lines:
    if x in line:  # if line.find(x) != -1: 使用 Python 更強的功能
        n += 1
        print(n, ' ', line, end="")  # 預設結束換列
print(f'\n總共 {n} 題目')

留言

  1. 商業軟體,期中考,more functions其他函數。https://zhonghexiao.blogspot.com/2026/11/excelformulas.html
    1110俄羅斯方塊,最好的版本。https://zhonghexiao.blogspot.com/2026/11/blogger-html-tetrisbackground101827colo.html
    期中考完整。https://zhonghexiao.blogspot.com/2026/11/htmlcssjavascriptpython.html
    pre沒有結束。https://zhonghexiao.blogspot.com/2026/10/excelvlookupindirectctrl-shift-enter.html
    https://zhonghexiao.blogspot.com/2026/10/file-open_0780581735.html
    https://zhonghexiao.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

蕭中和w3schools字串str串列list集合set字典dict元組tuple

蕭中和PYTHON撰寫金融常使測試網頁