I have a file containing a file "dir.txt" with the below data:
/home/abc/a.txt
/home/abc/b.txt
/home/xyz/test
/home/xyz/test/d.txt
/home/xyz/test/e.txt
/home/xyz/test/f.txt
/home/xyz
/home/xyz/g.txt
I want to parse the file and get the output like
/home/abc/a.txt
b.txt
/home/xyz/test/d.txt
e.txt
f.txt
/home/xyz/g.txt
Using python, basically need to print the content in a tree format. How would I process it?