Handling nested directories with recursion /u/iBerk07 Python Education

So we have this assignment, which wants us to traverse nested directories (e.g. “root[file1(10),file2(20),files[file(15),subdir2[myfile4(25),file5(30)]]]”) and count files, find the file with the maximum size, sum all the file sizes. I am very lost with this, I thought of many ways but could not figure out one working. Using lists, dictionaries, for-while loops are restricted. We have to use recursion. Any hints or recommendations on how to approach the problem would be very useful. Thank you.

submitted by /u/iBerk07
[link] [comments]

​r/learnpython So we have this assignment, which wants us to traverse nested directories (e.g. “root[file1(10),file2(20),files[file(15),subdir2[myfile4(25),file5(30)]]]”) and count files, find the file with the maximum size, sum all the file sizes. I am very lost with this, I thought of many ways but could not figure out one working. Using lists, dictionaries, for-while loops are restricted. We have to use recursion. Any hints or recommendations on how to approach the problem would be very useful. Thank you. submitted by /u/iBerk07 [link] [comments] 

So we have this assignment, which wants us to traverse nested directories (e.g. “root[file1(10),file2(20),files[file(15),subdir2[myfile4(25),file5(30)]]]”) and count files, find the file with the maximum size, sum all the file sizes. I am very lost with this, I thought of many ways but could not figure out one working. Using lists, dictionaries, for-while loops are restricted. We have to use recursion. Any hints or recommendations on how to approach the problem would be very useful. Thank you.

submitted by /u/iBerk07
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *