今天爱分享给大家带来Python如何获取文件扩展名【面试题详解】,希望能够帮助到大家。
使用os.path.splitext方法:
>>> import os
>>> fileName, fileExtension = os.path.splitext('/path/to/somefile.ext')
>>> fileName
'/path/to/somefile'
>>> fileExtension
'.ext'
原文链接:https://itblood.website/4410.html,转载请注明出处。

![家务:House Chores V1.15 AI汉化版[更新][PC+安卓][6.3G] [欧美RPG/汉化/动态]](/wp-content/uploads/replace/2025/09/09/681e938e4d9dd561900fa17eeb01d5a8.webp)