手机
当前位置:查字典教程网 >脚本专栏 >python >python获取文件扩展名的方法
python获取文件扩展名的方法
摘要:本文实例讲述了python获取文件扩展名的方法。分享给大家供大家参考。具体实现方法如下:importos.pathdeffile_exten...

本文实例讲述了python获取文件扩展名的方法。分享给大家供大家参考。具体实现方法如下:

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

输出结果为:

.gif

希望本文所述对大家的Python程序设计有所帮助。

【python获取文件扩展名的方法】相关文章:

python合并文本文件示例

python 获取et和excel的版本号

python 文件与目录操作

python操作日期和时间的方法

Python读写Excel文件的实例

python解析模块(ConfigParser)使用方法

Python中使用中文的方法

Python 文件和输入输出小结

python操作xml文件示例

python Django模板的使用方法(图文)

精品推荐
分类导航