How to parse a directory tree in python?

Posted by chutsu on Stack Overflow See other posts from Stack Overflow or by chutsu
Published on 2010-05-29T23:10:44Z Indexed on 2010/05/29 23:12 UTC
Read the original article Hit count: 185

Filed under:

I have a directory called "notes" within the notes I have categories which are named "science", "maths" ... within those folder are sub-categories, such as "Quantum Mechanics", "Linear Algebra".

./notes
--> ./notes/maths
------> ./notes/maths/linear_algebra
--> ./notes/physics/
------> ./notes/physics/quantum_mechanics

My problem is that I don't know how to put the categories and subcategories into TWO SEPARATE list/array.

© Stack Overflow or respective owner

Related posts about python