• 1.切割字符

    ls = "asdada.ad"
    print(ls[ls.rfind('.')+1:])
    
  • 2.os.path模块

    import os.path
    def file_extension(path):
        return os.path.splitext(path)[1]
    print file_extension("")		#输入文件路径
    

相关文章:

  • 2021-06-05
  • 2021-07-19
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
猜你喜欢
  • 2021-12-03
  • 2021-10-04
  • 2021-10-24
  • 2022-12-23
  • 2021-10-15
  • 2021-10-20
  • 2021-12-03
相关资源
相似解决方案