Kiran Kotari added the comment:

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']

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25979>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to