查找文本中的某個(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)留言刪除!!!


評(píng)論