[英]Why is the glob method finding different files in Python?
可能是兩次運行配置中指定的工作目錄不同,或者每次運行時unsorted glob看起來都不一樣。
無論如何,具體說明您想要 glob 的路徑(並對 glob 進行排序)應該可以解決問題:
from pathlib import Path
path = Path(__file__).parent # The directory that this file is in
for file in sorted(path.glob('*')):
print(file)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.