Skip to content

Instantly share code, notes, and snippets.

@ly0
Created February 8, 2014 18:16
Show Gist options
  • Save ly0/8887780 to your computer and use it in GitHub Desktop.
Save ly0/8887780 to your computer and use it in GitHub Desktop.
百度网盘api范例 遍历网盘
import json
from baidupcsapi import PCS
pcs = PCS('username','password')
def walk(path, tabs=0):
print '\t'*tabs+path
files = json.loads(pcs.list_files(path).content)['list']
for file in files:
if file['isdir'] == 1:
walk(file['path'],tabs=tabs+1)
else:
print '\t'*(tabs+1)+file['server_filename']
walk('/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment