我試圖提取包含EOB_FILE例如,我有類似的東西s = "path Omega/CC/Pune/SYNTT/EOB_PROCESSED_BY_OCR/EOB_FILE/0A225618045646F2AEEFC23E74CAC253/0A225618045646F2AEEFC23E74CAC253_page1.json"我怎么能只得到文件名,這是0A225618045646F2AEEFC23E74CAC253_page1.json我嘗試的代碼 :val = re.findall(r'([^.]*EOB_FILE[^.]*)', s)
val
['path Omega/CC/Pune/SYNTT/EOB_PROCESSED_BY_OCR/EOB_FILE/0A225618045646F2AEEFC23E74CAC253/0A225618045646F2AEEFC23E74CAC253_page1']預期輸出:0A225618045646F2AEEFC23E74CAC253_page1.json
python使用給定的正則表達式格式提取文件
慕田峪7331174
2022-09-06 17:50:49