https://github.com/amirali104/code-cleaner
A program to automatically remove line numbers and python shell prompt characters from a code
https://github.com/amirali104/code-cleaner
argparse automation code-cleaner code-cleanup console-application line-number line-numbers python python3 regex regex-pattern script
Last synced: about 2 months ago
JSON representation
A program to automatically remove line numbers and python shell prompt characters from a code
- Host: GitHub
- URL: https://github.com/amirali104/code-cleaner
- Owner: AmirAli104
- License: mit
- Created: 2025-04-07T16:10:35.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-06-25T09:35:08.000Z (4 months ago)
- Last Synced: 2025-07-25T18:00:10.680Z (3 months ago)
- Topics: argparse, automation, code-cleaner, code-cleanup, console-application, line-number, line-numbers, python, python3, regex, regex-pattern, script
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# code-cleaner
Maybe you have experienced that sometimes you copy a code from somewhere to paste it in your computer and run it. But in some websites they have placed the line numbers in such a way that when you copy the code the line numbers are also copied. You can remove these with this program.
You can also remove python shell prompts (`>>>` and `...`) from python codes.
command-line options
---|option|description|
|------|------|
|`-n,--line`|files/directories to clear line numbers|
|`-s,--shell`|files/directories to clear shell prompt characters|
|`-d,--directory`|Consider the values given to '--shell' and '--line' as directories. You must give the file extentions you want to clean them to this argument. Its default is '.py' files.|
|`-t,--tree`|If the both '--directory' and '--tree' are enabled it searches all subdirectories to find files|
|`-v,--verbose`|Enable verbose mode|Examples
---```
python code-cleaner.py -s a.py b.py -n a.c
```The above command cleans the line numbers from `a.c` and the shell prompt characters from `a.py`.
```
python code-cleaner.py -n codes_directory -d .c .py -t -l
```The above command cleares the line numbers from the `.c` and `.py` files in the given directory and also shows the log. Because of the `-t` argument it checks all subdirectories.