📅  最后修改于: 2022-03-11 14:45:59.153000             🧑  作者: Mango
import os
isfile = os.path.isfile
join = os.path.join
directory = 'mydirpath'
number_of_files = sum(1 for item in os.listdir(directory) if isfile(join(directory, item)))