python-small-examples

@author jackzhenguo
@desc 
@date 2019/9/10

103 获取后缀名

import os
file_ext = os.path.splitext('./data/py/test.py')
front,ext = file_ext
In [5]: front
Out[5]: './data/py/test'

In [6]: ext
Out[6]: '.py'
[上一个例子](/python-small-examples/md/102.html) [下一个例子](/python-small-examples/md/104.html)