Print a directory tree structure in your Python code.

Overview

directory-structure

PyPI PyPI - Downloads PyPI - License GitHub watchers GitHub Repo stars GitHub forks

Print a directory tree structure in your Python code.

Download

You can simply:

pip install directory-structure

Or you can also:

  1. Clone the repository to your local machine.
  2. Enter the directory.
  3. 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 as an argument.

path = Tree('C:/Users/User/Desktop/directory-structure', absolute=True)
print(path)
๐Ÿ“‚ C:
|_๐Ÿ“‚ Users
  |_๐Ÿ“‚ User
    |_๐Ÿ“‚ Desktop
      |_๐Ÿ“‚ directory-structure
        |_๐Ÿ“ .git
        |_๐Ÿ“ directory_structure
        |_๐Ÿ“„ .gitignore
        |_๐Ÿ“„ 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
|_๐Ÿ“„ .gitignore
|_๐Ÿ“„ 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=True)
print(path)
๐Ÿ“‚ C:
|_๐Ÿ“‚ Users
  |_๐Ÿ“‚ User
    |_๐Ÿ“‚ Desktop
      |_๐Ÿ“ directory-structure
      |_๐Ÿ“„ Discord.lnk
      |_๐Ÿ“„ Spotify.lnk
      |_๐Ÿ“„ Steam.lnk
      |_๐Ÿ“„ Telegram.lnk
      |_๐Ÿ“„ Visual Studio Code.lnk
      |_๐Ÿ“„ WhatsApp.lnk
path = Tree('../', absolute=False)
print(path)
๐Ÿ“‚ Desktop
|_๐Ÿ“ directory-structure
|_๐Ÿ“„ Discord.lnk
|_๐Ÿ“„ Spotify.lnk
|_๐Ÿ“„ Steam.lnk
|_๐Ÿ“„ Telegram.lnk
|_๐Ÿ“„ Visual Studio Code.lnk
|_๐Ÿ“„ WhatsApp.lnk

forthebadge forthebadge

Owner
Gabriel Stork
Python
Gabriel Stork
A simple stopwatch for measuring code performance with static typing.

A simple stopwatch for measuring code performance. This is a fork from python-stopwatch, which adds static typing and a few other things.

Rafael 2 Feb 18, 2022
An interpreter for the X1 bytecode.

X1 Bytecode Interpreter The X1 Bytecode is bytecode designed for simplicity in programming design and compilation. Bytecode Instructions push

Thanasis Tzimas 1 Jan 15, 2022
An analysis tool for Python that blurs the line between testing and type systems.

CrossHair An analysis tool for Python that blurs the line between testing and type systems. THE LATEST NEWS: Check out the new crosshair cover command

Phillip Schanely 836 Jan 08, 2023
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 05, 2023
Turn your Python and Javascript code into DOT flowcharts

Notes from 2017 This is an older project which I am no longer working on. It was built before ES6 existed and before Python 3 had much usage. While it

Scott Rogowski 3k Jan 09, 2023
Collects all accepted (partial and full scored) codes submitted within the given timeframe and saves them locally for plagiarism check.

Collects all accepted (partial and full scored) codes submitted within the given timeframe of any contest.

ARITRA BELEL 2 Dec 28, 2021
Pymwp is a tool for automatically performing static analysis on programs written in C

pymwp: MWP analysis in Python pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of m

Static Analyses of Program Flows: Types and Certificate for Complexity 2 Dec 02, 2022
Print a directory tree structure in your Python code.

directory-structure Print a directory tree structure in your Python code. Download You can simply: pip install directory-structure Or you can also: Cl

Gabriel Stork 45 Dec 19, 2022
C/C++ Dependency Analyzer: a rewrite of John Lakos' dep_utils (adep/cdep/ldep) from

Version bรชta d'un systรจme pour suivre les prix des livres chez Books to Scrape, un revendeur de livres en ligne. En pratique, dans cette version bรชta, le programme n'effectuera pas une vรฉritable surv

Olzhas Rakhimov 125 Sep 21, 2022
This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

Nipuna Weerasekara 2 Mar 10, 2022
Collection of library stubs for Python, with static types

typeshed About Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as con

Python 3.3k Jan 02, 2023
A bytecode vm written in python.

CHex A bytecode vm written in python. hex command meaning note: the first two hex values of a CHex program are the magic number 0x01 (offset in memory

1 Aug 26, 2022
A very minimalistic python module that lets you track the time your code snippets take to run.

Clock Keeper A very minimalistic python module that lets you track the time your code snippets take to run. This package is available on PyPI! Run the

Rajdeep Biswas 1 Jan 19, 2022
Auto-generate PEP-484 annotations

PyAnnotate: Auto-generate PEP-484 annotations Insert annotations into your source code based on call arguments and return types observed at runtime. F

Dropbox 1.4k Dec 26, 2022
Inspects Python source files and provides information about type and location of classes, methods etc

prospector About Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and comple

Python Code Quality Authority 1.7k Dec 31, 2022
A formatter for Python files

YAPF Introduction Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- are made to remove lint errors from code. This has som

Google 13k Dec 31, 2022
Find usage statistics (imports, function calls, attribute access) for Python code-bases

Python Library stats This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library import

Francisco Massa 13 May 02, 2022
CodeAnalysis - Static Code Analysis: a code comprehensive analysis platform

TCA, Tencent Cloud Code Analysis English | ็ฎ€ไฝ“ไธญๆ–‡ What is TCA Tencent Cloud Code A

Tencent 1.3k Jan 07, 2023
Robocop is a tool that performs static code analysis of Robot Framework code.

Robocop Introduction Documentation Values Requirements Installation Usage Example Robotidy FAQ Watch our talk from RoboCon 2021 about Robocop and Robo

marketsquare 132 Dec 29, 2022
Learning source code review, spot vulnerability, find some ways how to fix it.

Learn Source Code Review Learning source code review, spot vulnerability, find some ways how to fix it. WordPress Plugin Authenticated Stored XSS on C

Shan 24 Dec 31, 2022