How to extract the file name from a file path?

后端 未结 4 355
我在风中等你
我在风中等你 2021-01-04 03:51

I have the following code:

os.listdir(\"staging\")

# Seperate filename from extension
sep = os.sep

# Change the casing
for n in os.listdir(\"staging\"):
           


        
4条回答
  •  一生所求
    2021-01-04 04:31

    import os
    pathname ='c:\\hello\\dickins\\myfile.py'
    head, tail = os.path.split(pathname)
    print head
    print tail
    

提交回复
热议问题