我正在尝试对一些扩展名为.sim的模拟文件进行排序。目前,我有以下代码:
import os
import re
files = [f for f in os.listdir('.') if re.match(r'.*\.sim', f)]
print(files)
当我运行代码时,会得到以下结果:
['Yunlin_Shorepull_South_Current_1.8_Wind_0.sim',
'Yunlin_Shorepull_South_Current_1.8_Wind_0_Relocated.sim',
'Yunlin_Shorepull_South_Current_1.8_Wind_1.sim',
'Yunlin_Shorepull_South_Current_1.8_Wind_10.sim',
'Yunlin_Shorepull_South_Current_1.8_Wind_10_Relocated.sim',
'Yunlin_Shorepull_South_Current_1.8_Wind_11.sim', ...]
相关问题 更多 >
编程相关推荐