-3
我想通過使用正則表達式從文件名中沒有「test」和「dummy」的位置讀取僅文件。如何使用Python使用正則表達式搜索字符串中的多個單詞
例如文件路徑下面有文件。
file1.csv
file2.txt
20170811_test_1.dat
1_dummy_20170811.dat
在這裏,我需要找到file1.csv和FILE2.TXT並排除其中有測試或虛所有其他文件(可以是任何情況下/上的)。
所以,Python或C#? –
檢查此鏈接 - https://superuser.com/questions/903168/how-should-i-write-a-regex-to-match-a-specific-word – AGrammerPro
通常有核心的方法,讓你做基本搜索子字符串。在Python中,您可以執行[str.find()](https://docs.python.org/2/library/string.html#string.find) – linden2015