主要介绍了python获取文件扩展名的方法,涉及Python针对文件路径的相关操作技巧

import os.path 
def file_extension(path): 
  return os.path.splitext(path)[1] 
print file_extension('C:\py\wxPython.gif')

输出结果为:
.gif

相关文章:

  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-29
  • 2021-09-25
  • 2021-12-22
  • 2022-12-23
  • 2021-07-03
  • 2022-01-25
相关资源
相似解决方案