📜  python 遍历文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:57.118000             🧑  作者: Mango

代码示例3
import os

directory = os.fsencode(directory_in_str)
    
for file in os.listdir(directory):
     filename = os.fsdecode(file)
     if filename.endswith(".asm") or filename.endswith(".py"): 
         # print(os.path.join(directory, filename))
         continue
     else:
         continue