我自己找到了一个解决办法(从 肌氨酸
我看到了 scipy.ndimage.filters.maximum_filter (可以找到 here footprint = np.ones((size_neighborhood, size_neighborhood, nr_rotations)) .
scipy.ndimage.filters.maximum_filter
footprint = np.ones((size_neighborhood, size_neighborhood, nr_rotations))
您可以检查目录是否存在。 os.path.isdir 您将得到当前时间戳 datetime 图书馆。
os.path.isdir
datetime
import datetime import os path = "/home/folder-20190228/" current_timestamp = f"{datetime.datetime.now():%Y%m%d}" if os.path.isdir(path): path = '-'.join([path.split('-')[0], current_timestamp])