更新时间:2023-08-26 12:17:34
我建议使用 os.path.splitext
获取不带扩展名的文件名.
I suggest using os.path.splitext
to get the filename without extension.
>>> from os.path import splitext
>>> for f in file_list:
... name = splitext(f)[0]
... if any(name.endswith(tail) for tail in word):
... print(name)
...
h_ABC_U12
h_GGG_U13
h_HVD_U14