字符串查找_查找關(guān)鍵字_python

admin Python評(píng)論94字?jǐn)?shù) 237閱讀模式

字符串查找_查找關(guān)鍵字_python

查找文本中的某個(gè)值是否存在,用以下方法查找文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.s143.cn/12843.html

import os

path = r"D:\網(wǎng)絡(luò)游戲\三角洲行動(dòng)\Delta Force\Delta Force\DeltaForce\Binaries\Win64"

# 方法1:直接判斷
if "網(wǎng)絡(luò)游戲" in path:
    print("路徑中包含'網(wǎng)絡(luò)游戲'")
else:
    print("路徑中不包含'網(wǎng)絡(luò)游戲'")

# 方法2:使用os.path方法
if "網(wǎng)絡(luò)游戲" in os.path.normpath(path):
    print("路徑中包含'網(wǎng)絡(luò)游戲'")
文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.s143.cn/12843.html文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.s143.cn/12843.html
版權(quán)聲明:文章圖片資源來(lái)源于網(wǎng)絡(luò),如有侵權(quán),請(qǐng)留言刪除!!!
廣告也精彩
admin
  • 本文由 發(fā)表于 2025年9月6日 23:03:51
  • 轉(zhuǎn)載請(qǐng)務(wù)必保留本文鏈接:http://www.s143.cn/12843.html
匿名

發(fā)表評(píng)論

匿名網(wǎng)友 填寫信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: