Print a directory tree structure in your Python code.
Project description
directory-structure
Print a directory tree structure in your Python code.
Download
You can simply:
pip install directory-structure
Or you can also:
- Clone the repository to your local machine.
- Enter the directory.
- Download necessary modules/libraries.
git clone https://github.com/gabrielstork/directory-structure.git
cd directory-structure
pip install -r requirements.txt
Examples
from directory_structure import Tree
- Using absolute path.
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=True)
print(path)
๐ C:
|_๐ Users
|_๐ User
|_๐ Desktop
|_๐ directory-structure
|_๐ .git
|_๐ directory_structure
|_๐ dist
|_๐ LICENSE
|_๐ pyproject.toml
|_๐ README.md
|_๐ requirements.txt
|_๐ setup.py
path = Tree('C:/Users/User/Desktop/directory-structure', absolute=False)
print(path)
๐ directory-structure
|_๐ .git
|_๐ directory_structure
|_๐ dist
|_๐ LICENSE
|_๐ pyproject.toml
|_๐ README.md
|_๐ requirements.txt
|_๐ setup.py
- Accessing a folder in current working directory.
path = Tree('./directory-structure', absolute=True)
print(path)
๐ C:
|_๐ Users
|_๐ User
|_๐ Desktop
|_๐ directory-structure
|_๐ directory_structure
|_๐ tree.py
|_๐ __init__.py
path = Tree('./directory_structure', absolute=False)
print(path)
๐ directory_structure
|_๐ tree.py
|_๐ __init__.py
- Getting all from the directory where your current working directory is.
path = Tree('../', absolute=False)
print(path)
๐ Desktop
|_๐ dados-futebol-brasileiro
|_๐ directory-structure
|_๐ fast-ml
|_๐ learning-django
|_๐ text-codifier
|_๐ to-do-list
|_๐ Discord.lnk
|_๐ Owlboy.url
|_๐ Spotify.lnk
|_๐ Steam.lnk
|_๐ Sublime Text 3.lnk
|_๐ Telegram.lnk
|_๐ The Binding of Isaac Rebirth.url
|_๐ Visual Studio Code.lnk
|_๐ WhatsApp.lnk
You can write any valid path, and it will work. These were only few examples.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for directory-structure-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0166bc712a2865ecd56cf48d0b0f48f233e95c01dc1e7625ecce48599e68069 |
|
MD5 | dec7eb59315aed64e1563507cdebf58d |
|
BLAKE2b-256 | 6e323430edecb5260c4382bc87bdf0820bbd66729b7ffd150746c0fedf94eb0c |
Close
Hashes for directory_structure-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83d11ac36ccfd471a43d76b6ab3e313c8748886dd921b896f7cfe650adb58674 |
|
MD5 | 7ff400edb5c83c4866b0a9cabb4d6646 |
|
BLAKE2b-256 | e06fe8dd878d1b6bbcc5ce578a72b4d0fd8cec163077b863adc14a5891666968 |