python获取文件扩展名的方法
作者:pythoner 时间:2023-07-20 09:05:17
本文实例讲述了python获取文件扩展名的方法。分享给大家供大家参考。具体实现方法如下:
import os.path
def file_extension(path):
return os.path.splitext(path)[1]
print file_extension('C:\py\wxPython.gif')
输出结果为:
.gif
希望本文所述对大家的Python程序设计有所帮助。
标签:python,文件,扩展名
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
MySQL 查询 并集、交集、差集方式
2024-01-18 11:34:36
![](https://img.aspxhome.com/file/2023/8/128388_0s.png)
JavaScript字符串对象(string)基本用法示例
2024-04-17 10:00:31
![](https://img.aspxhome.com/file/2023/8/136428_0s.png)
python中import学习备忘笔记
2021-05-15 02:27:14
一文带你安装opencv与常用库(保姆级教程)
2021-03-11 12:21:19
![](https://img.aspxhome.com/file/2023/6/131756_0s.jpg)
Redux saga异步管理与生成器详解
2023-07-24 02:53:52
![](https://img.aspxhome.com/file/2023/9/55999_0s.png)
趣味Python实战练习之自动更换桌面壁纸脚本附源码
2021-11-03 09:12:33
![](https://img.aspxhome.com/file/2023/9/82549_0s.jpg)
Yii框架学习笔记之应用组件操作示例
2024-05-11 09:23:07
python制作机器人的实现方法
2022-11-09 21:09:05
![](https://img.aspxhome.com/file/2023/5/134935_0s.png)
数字人组件反写[asp组件开发实例3]
2009-06-09 13:16:00
![](https://img.aspxhome.com/file/UploadPic/20093/9/200939182818419s.gif)
Mysql字符串截取及获取指定字符串中的数据
2024-01-24 21:07:46
PHP析构函数destruct与垃圾回收机制的讲解
2023-07-11 21:05:36
怎样在不同版本SQL Server中存储数据
2009-01-20 13:11:00
Go语言Zap日志库使用教程
2024-05-05 09:27:11
![](https://img.aspxhome.com/file/2023/4/128694_0s.png)
python实现Scrapy爬取网易新闻
2021-11-23 17:02:11
![](https://img.aspxhome.com/file/2023/1/93691_0s.jpg)
Tensorflow训练模型越来越慢的2种解决方案
2021-06-04 20:55:53
Python&Matlab实现蚂蚁群算法求解最短路径问题的示例
2021-09-18 15:40:11
![](https://img.aspxhome.com/file/2023/2/124152_0s.png)
Mysql的Table doesn't exist问题及解决
2024-01-16 05:03:13
SQL Server 日期相关资料详细介绍
2012-07-11 16:14:07
字符编码笔记 ASCII,Unicode和UTF-8
2023-08-02 23:26:03
![](https://img.aspxhome.com/file/2023/1/131881_0s.jpg)
layer弹窗插件操作方法详解
2023-08-09 14:30:14