os.path.split

tslam發表於2024-06-17
str1 = "/Users/krunal/Desktop/code/pyt/app.pyt"



import os

res = os.path.split(str1)
res1 = os.path.splitext(str1)


print(res)
print(res1)

"""
('/Users/krunal/Desktop/code/pyt', 'app.pyt')
('/Users/krunal/Desktop/code/pyt/app', '.pyt')
"""