Edit text file, encrypt and decrypt with python easily!
Project description
TxtStr
Edit text file, encrypt and decrypt with python!
Explore the docs »
Report Bug
·
Request Feature
About The Project
If you want the explanation ask me in Twitch link
Release notes
Hi!, the new update of txtstr brings new commands that were necessary for this library to be useful, some commands have been modified to make it even easier to obtain the information they give you, below you will see the list of new and updated commands, Thanks so much for welcoming txtstr, good luck coding!
Bug fix
We have fixed a bug that causes the word encrypt to be displayed in the console while decrypting, all fixed!
Getting Started
Prerequisites
You need to make sure you have installed the following modules. The requirements are installed automatically, but for any errors here are the commands to install each dependency
-
Cryptography
pip install cryptography
-
Docx
pip install docx
-
Fpdf
pip install fpdf
Installation
pip install txtstr
Usage
- txtstr.__init__()
import txtstr txtstr.__init__()
This starts all the functions to encrypt and decrypt the txt files, it creates a folder for you and the decryption key also starts the modules
-
txtstr.newkey(name)
import txtstr txtstr.newkey(name)
Create a new UNIQUE key to be able to encrypt and decrypt the files if you want someone to decrypt your files you have to pass them this key
- txtstr.loadkey(name)
import txtstr key = txtstr.loadkey(name) print(key)
Here you can see your UNIQUE key to share it and use it in your programs when you think it is necessary
- txtstr.encrypt(file, CUSTOM_KEY, times)
import txtstr file = "file.txt" txtstr.encrypt(file,None,5)
That this function can encrypt your file, the FILE section is where you can find the path of your .TXT file, CUSTOM_KEY if you put None it is because you want to use the default txtstr key, it is always advisable to create yours beforehand, to locate yours just type the name of the key (if it is in the same folder), but if it is in another folder, use the path of said file. Remember not to lose these keys since without this it will be IMPOSSIBLE to decrypt it. TIMES indicates the number of times you want this file to be encrypted remember the number as it will be the same number of times to decrypt them.
- txtstr.decrypt(file, CUSTOM_KEY, times)
import txtstr file = "file.txt" txtstr.decrypt(file, None, 5)
Here you can decrypt your file, the FILE section is for the path of your file and the CUSTOM_KEY if you put None it is because you want to use the default txtstr key, it is always advisable to create yours beforehand, to locate yours just type the name of the key (if it is in the same folder), but if it is in another folder, use the path of said file. TIMES here you must put the number of times you want to decrypt it this must be the same as the time you encrypted it.
- txtstr.write(name,text,add)
import txtstr text = "the develpoer of txtstr is the best UnU" name = "isTRUE" txtstr.write(name, text, True)
If ADD is True the text will be added to the file but if it is False it will be rewritten
-
txtstr.newtxt(name)
import txtstr name = "file.txt" txtstr.newtxt(name)
This will create a new text file, you can change the name to an address where this file will be saved
-
txtstr.search(name,searchfor,advanced)
import txtstr name = "file.txt" searchfor = "hi" info = txtstr.search(name, searchfor, True)
If ADVANCED is True, you must define a single variable as in this case "info" will return a dictionary where "isin" is if it was found, "quantity" is the number of times it appears, "linesamount" the number of lines your file has, "lineappear" is a list where you will find the line number where it is located
import txtstr
name = "file.txt"
searchfor = "hi"
IsIn, quantity, linesamount, lineappear = txtstr.search(name, searchfor, False)
If ADVANCED is False, you must define three variables to give the following values "isin" is if it was found, "quantity" is the number of times it appears, "linesamount" the number of lines your file has, "lineappear" is a list where you will find the line number where it is located
-
txtstr.read(file)
import txtstr file = "file.txt" text = txtstr.read(file) print(text)
-
txtstr.readlines(file)
import txtstr file = "file.txt" text = txtstr.readlines(file) print(lines)
This is similar to txtstr.read() but here each line of your file will be saved to a list remember that it starts counting from zero if you want to print a specific line you can do
print(lines[ 10])
-
txtstr.addline(name,line)
import txtstr line = "Hi ty for supporting txtstr!" txtstr.addline(name,line)
-
txtstr.rename(file,new_name)
import txtstr file = "file.txt" new_name = "txtstr" txtstr.rename(file,new_name)
Experimental functions
-
txtstr.toword(file)
import txtstr file = "file.txt" txtstr.toword(file)
-
txtstr.topdf(file)
import txtstr file = "file.txt" txtstr.topdf(file)
-
txtstr.checkupdate()
import txtstr txtstr.checkupdate()
With this you can automatically install any new version of txtstr
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Discord: PingüiMaya14#2055
WebSite: pingui.tk
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
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 txtstr-2.1.0.tar.gz.
File metadata
- Download URL: txtstr-2.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e98eafeca2f276e23bdde44d503c107c893a0df5c38ceb11510e302586384f4
|
|
| MD5 |
e41f19b34fd39764efd2c5a99f0e51d7
|
|
| BLAKE2b-256 |
a739b170aab05429d387d3c142f66539ce7d2b65bd9cf8334734193bc86420ec
|
File details
Details for the file txtstr-2.1.0-py3-none-any.whl.
File metadata
- Download URL: txtstr-2.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa11e1c77f4c2bdc47616669cbb5bea0f4c00f9f07ad060458cdb8fc235b0fe5
|
|
| MD5 |
53de183710b311b0b94763b94c6401bf
|
|
| BLAKE2b-256 |
4a32679a35f9868b20c3b5aba8495f6a260946cb1bd6b2d5f1c0c1671078acf5
|