劉任昌python輸入input尋找find沒找到-1

file = open('金融常識.txt','r',encoding='utf-8')
lines = file.readlines()
file.close()
x = input('劉任昌入搜尋關鍵詞: ')
for line in lines:
 if line.find(x) != -1: print(line,end="")
file = open('金融常識.txt','r',encoding='utf-8')
lines = file.readlines()
file.close()
x = input('劉任昌輸入搜尋關鍵詞: ')
n = 0
for line in lines:
    if line.find(x) != -1: 
        n=n+1
        print(n,' ',line,end='')
print(f'總共{n}題')
file = open('金融常識.txt','r',encoding='utf-8')
lines = file.readlines()
file.close()
x = input('劉任昌輸入搜尋關鍵詞: ')
n = 0
for line in lines:
    if x in line:
        n=n+1
        print( n, ' ', line,end='')
print(f'總共{n}題')
file = open('金融常識.txt','r',encoding='utf-8')
reading = file.read()
file.seek(0) #回到檔案的開始
lines = file.readlines()
file.close()
print('read()方法讀共', len(reading), 'readlines()方法讀共', len(lines))
x = input('劉任昌輸入搜尋關鍵詞: ')
n = 0
for line in lines:
    if x in line:
        n=n+1
        print( n, ' ', line,end='')
print(f'總共{n}題')

留言

  1. 作者已經移除這則留言。

    回覆刪除
  2. https://1qaz1234567890.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  3. https://ruojinnng.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  4. https://hannie0-hannie.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  5. https://lin-cen-ting.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  6. https://mina-zi.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  7. https://yeyuyu.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  8. https://www.blogger.com/blog/post/edit/289035863256802941/4843089528351828614

    回覆刪除
  9. https://chialing112233.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  10. https://lzq970609.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  11. 作者已經移除這則留言。

    回覆刪除
  12. https://cenruri.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  13. https://guojhenglong.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  14. https://asfry65df.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  15. https://julian696969.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  16. https://tyuiop715547.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  17. https://louzhengyi.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  18. https://glacier0831.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  19. https://kaoreki0514.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  20. https://yiting111.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  21. https://zzy317.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  22. https://ruoyiiiiii.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  23. 作者已經移除這則留言。

    回覆刪除
  24. 作者已經移除這則留言。

    回覆刪除
  25. https://lutingjuan.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  26. https://www.blogger.com/blog/post/edit/7408110137795804233/1405348731732587656

    回覆刪除
  27. https://serein-chen.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  28. 作者已經移除這則留言。

    回覆刪除
  29. https://sihyin0526.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  30. https://yubaiyan.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  31. https://gangyouli6.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  32. https://lyz0216.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  33. https://www.blogger.com/blog/post/edit/preview/1842616417466022125/5361085818415382158

    回覆刪除
  34. https://cherylevangeline.blogspot.com/2026/10/preborderred-solid-3-px-file-open.html

    回覆刪除
  35. https://ding-zi-qin.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  36. https://weruowjjlsmo9k.blogspot.com/2026/10/inputfind-1.html

    回覆刪除
  37. https://chang-wen-yuan.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  38. https://liuyidi.blogspot.com/2026/10/pythoninputfind-1_0958985067.html

    回覆刪除
  39. https://pythonhtml1.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  40. https://123wqeasd.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  41. https://julian696969.blogspot.com/2026/10/pythoninputfind-1_0206097737.html

    回覆刪除
  42. https://zxcvbnm15963.blogspot.com/2026/10/file-open.html

    回覆刪除
  43. https://zhjlllll.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  44. https://www.blogger.com/blog/post/edit/preview/6969370829164329875/4451444056293656679

    回覆刪除
  45. https://www.blogger.com/blog/post/edit/preview/1070248541590854509/2306423205812906454

    回覆刪除
  46. https://yppp077.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  47. https://cynthia088.blogspot.com/2026/10/file-open_0274634976.html

    回覆刪除
  48. https://yangxinzhen.blogspot.com/2026/10/pythoninputfind-1.html

    回覆刪除
  49. 作者已經移除這則留言。

    回覆刪除
  50. https://yuyouzi.blogspot.com/2026/11/preborderred-solid-3px-file-open.html

    回覆刪除
  51. https://linhongen.blogspot.com/2026/11/pythoninputfind-1.html

    回覆刪除
  52. https://linhongen.blogspot.com/2026/11/python.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

劉任昌EXCEL產生網頁

劉任昌w3schools字串str串列list集合set字典dict元組tuple

內建函數print, type, ord字碼, chr字元