Message257224
In this python code I am collecting list of folders present in the given location path with parent folder and print the folder names (output went wrong due to escape sequence values with lstrip.)
Note :
"\a \b \f \r \v \0 \1" are working fine.
"\c \e \n \ne \t \te" went wrong.
Python Code :
import glob as g
class Folders:
def __init__(self, path, parent_folder_name):
self.path = path + parent_folder_name + '\\'
self.parent_folder_name = parent_folder_name
def showFolders(self):
folders = [lst.lstrip(self.path) for lst in g.glob(self.path + '*')]
print('Path: '+self.path+ ', List: ',folders)
pass
if __name__ == "__main__":
obj = Folders(path='.\\', parent_folder_name='parent')
obj.showFolders()
Folder Structure :
parent ->
cat
eat
east
next
nest
test
Wrong Output :
Path: .\parent\, List: ['cat', 'st', '', 'st', 'xt', 'st'] |
|
Date |
User |
Action |
Args |
2015-12-30 02:26:36 | Kiran Kotari | set | recipients:
+ Kiran Kotari |
2015-12-30 02:26:36 | Kiran Kotari | set | messageid: <1451442396.75.0.577772474599.issue25979@psf.upfronthosting.co.za> |
2015-12-30 02:26:36 | Kiran Kotari | link | issue25979 messages |
2015-12-30 02:26:36 | Kiran Kotari | create | |
|