Discuss / Python / 有的细节东西云里雾里,先上题吧

有的细节东西云里雾里,先上题吧

Topic source
import os
name=input('please enter the object:')
we=input('please:')
def search(we, name):
    for ling in os.listdir(we):
        pl=os.path.join(we,ling)
        if os.path.isfile(pl) and ling==name:
            print(os.path.realpath(pl))
        if os.path.isdir(pl):
            search(pl,name)

search(we,name)

lubang03

#2 Created at ... [Delete] [Delete and Lock User]

这里应该用relpath吧,相对路径,realpath还是绝对路径


  • 1

Reply