#Make space-- Choose space--Switch space#How we start OOP?-->space" "folderchoose = input () if choose = = Workspace.name:workspace.switch ()" " fromSconfigImportconfigs fromSubprocessImportPagerImportOSclassWorkspace:def __init__(self, c): Self.folders= c['Folders'] Self.name= c['name'] Self.target= c['Target'] defswitch (self): forLinkinchOs.listdir (self.target):ifF.endswith ('. WSPC'): Path= Self.target +f os.remove (path)#Mklink forSourceinchSelf.folders:real_target= Self.target + source.split ('/') [-1] +'. WSPC'commands= ['LN','- S', Source,real_target] Call (commands) W= Workspace ([a]) W2= Workspace ([4,5,6]) Workspace= [Workspace (c) forCinchConfigs]Print('pleace choice u workspace') Choice=input () forWinchWorkspace:ifW.name = =Choice:w.switch ()Print(w.folders)Print(w2.folders)
sconfig.py
Configs = [ { 'name':' Work', 'Folders':[ '/user/zhangfulong/desktop/pdf', '/user/zhangfulong/desktop/bookmarks', ], 'Target':'/user/zhangfulong/desktop/' }, { 'name':'PLAY', 'Folders':[ '/user/zhangfulong/desktop/video', '/user/zhangfulong/desktop/codes', ], 'Target':'/user/zhangfulong/desktop/' },]
Simple little Practice _ Switch Workspaces