Tool for extracting embedded text data in python script.
Project description
Tool for extracting embedded text data in python script.
Requirement
Python >= 3.9
pip3
Usage
Install
``` % pip install embedded-text ```
import in your script
import embedded_text
Embeddig text data at the end of your script with head/tail lines
```
if False:
############# Embedded Code Start #######################
#!/usr/bin/env python3
def main():
print ('This is the sample : ____OUTPUT_WORDS____')
if __name__ == '__main__':
main()
############# Embedded Code End #######################
```
Initialize class with regular expression of head/tail lines
```
s_pttrn = r'\s*#{5,}\s*Embedded\s+Code\s+Start\s*#{5,}',
e_pttrn = r'\s*#{5,}\s*Embedded\s+Code\s+End\s*#{5,}'},
extractor = EmbeddedText(s_marker=s_pttrn,
e_marker=e_pttrn, ...)
```
You can do iterator access by EmbeddedText.lines()
for line in extractor.lines(input_path=None): sys.stdout.write(line)You can save to other file by EmbeddedText.dump()
extractor.dump(output_path, input_path=None)
It is possible to apply the keyword replacement and text filtering. You can see the example in "main()" function in "embedded_text.py"
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedded_text-0.0.1.tar.gz.
File metadata
- Download URL: embedded_text-0.0.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa3cd1a14ce03f10f4818960454a5d15c122436ff8b27ec9c97e00d34a29db9
|
|
| MD5 |
56678362df10d5ba623bd917306ca221
|
|
| BLAKE2b-256 |
b28b87ffab96a6a407fa82cb9e250139db3c0eb509743e8d19d9fc691db45ae3
|
File details
Details for the file embedded_text-0.0.1-py3-none-any.whl.
File metadata
- Download URL: embedded_text-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1ce5639ba1e590133ac552087416dac1412a14b7ba92118e4d92bd3abe5fcda
|
|
| MD5 |
6801ef0909e38d15947bda5840604e3c
|
|
| BLAKE2b-256 |
1a2590bb29e235fa339ebeeec0ffa849619ebff0cf2351ca90ec3627558cefa6
|