高清CreateDropboxFolder(路徑,文件夾名):Dropbox v2 python api的createfolderarg()函數的格式有什麼問題?
##Connect to Dropbox with Supplied Access token
print('Connecting to Dropbox...')
dbx = dropbox.Dropbox('')
print('Connected to Dropbox')
##Reset Variables
DirExists=False
##Set Directory
TempDir=Path+FolderName
print('Started Creating New Directory: ' + TempDir + ' ...')
##Check if Location exists
print ('Searching for Existing Directory in '+ Path)
for entry in dbx.files_list_folder(path=os.path.dirname(Path)).entries:
print (entry.name)
if(entry.name==FolderName):
DirExists=True
break
##If Folder Directory exists Skip Create Directory
if DirExists==True:
print ('Folder Already Exists')
##If Folder Directory exists Create Directory
else:
##Create Client Directory
print('Creating New Directory: ' + TempDir)
dropbox.files.CreateFolderArg(os.path.dirname(TempDir))
print('Created New Directory: ' + TempDir)
return TempDir
每一部分的工作。除了上述功能。我嘗試過很多方式來格式化目錄字符串,但它不起作用。經過兩個晚上的挫折之後,我正要把我的頭髮拉出來。 我一直在傳遞Path ='/ Projects /',這是我的保管箱文件夾和FolderName ='test'的根目錄中的一個現有目錄。
「不起作用」?怎麼了?更加詳細一些。 – kindall