用python保存文件后缀名的方法:
1、splittext()方法
2、endswith()方法
path = "test_user_info.py" bool = path.endswith(".py") print(bool)
3.用split方法切割
path = "test_user_info.py" suffix = path.split(".")[1] print("suffix: {}".format(suffix))
Copyright © 2019- ovod.cn 版权所有 湘ICP备2023023988号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务