textfile I want to print the data from a text file in a tree structure.
consider two lines from a text file :
- dsin100days/content/Python_for_Data_Scientists/Introduction_to_Python/python-basics.ipynb
- dsin100days/content/Python_for_Data_Scientists/hello_world.txt
The output should be:
dsin100days
content
Python_for_Data_Scientists
Introduction_to_Python
python-basics.ipynb
hellow_world.txt
By this we can print all lines but how can i give them a structure. As i am newbie i did not understand how to do it.
with open('sample.txt') as dd:
for record in dd:
print(record)