ims_path='data/market1501/Market-1501-v15.09.15/bounding_box_test/12312.jpg'
ims_path.endswith('.jpg')

返回结果: True
应用:判断后缀名的示例:
Python 判断文件后缀

2. 方法2, os.path.splitext() 方法:

该方法返回两个元素, 第一个是路径去掉后缀的部分, 第二个是文件后缀:
Python 判断文件后缀

相关文章:

  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2021-09-22
  • 2022-12-23
相关资源
相似解决方案