This is a repo of some smallTools created by python.
Project description
Brief
This is a repo of some smallTools created by python.
rename_files
- This tool could rename all the files in a directory decided by you. You have
2
choices to rename them.
by order
- If you don't mind the
filename extension
, you could rename all of them at one time.Given New name and order key, the code will add the order automatically.
import pythonSmallToolsByHanXu.rename_files as rename
if __name__ == '__main__':
# replace the directory you want to rename
ex=rename.renamer(r"D:\Desktop\C & C++")
ex(new_name="demo",order_key=lambda x: int(x[ x.rfind(".")-1 : x.rfind(".")+1] ) )
by filename extension
- For example, if you want to rename all the images, you may type in
jpg
orpng
as followed.
import pythonSmallToolsByHanXu.rename_files as rename
if __name__ == '__main__':
# replace the directory you want to rename
ex=rename.renamer(r"D:\Desktop\C & C++")
ex(new_name="demo",target_type="jpg")
result:
normalize_md
- Usually, when we write the md file, the images in the md file are bundled with the internet. If you want to view the images offline, you should download the images at advanced and modify the image-urls in the md file, which is awful and takes much time! This tool allow you to download the internal images in the md file automatically so that you could view the md file without the internet anymore!
- The algorithm is in-place!You'd better copy the md dir in advance.
import pythonSmallToolsByHanXu.normalize_md as normal
if __name__ == '__main__':
# replace the directory you want to rename
target_directory = r"D:\Desktop\demo"
normal.normalizer(current_dir=target_directory)()
result:
- before:
- after:
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
Close
Hashes for pythonSmallToolsByHanXu-1.0.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d0b76d2df4bd4a593ddc742b55f2c821bc9baf2e76b0f71f6975dc05c8aff7f |
|
MD5 | 601ad2cdf253ed0fbf1611c05e305259 |
|
BLAKE2b-256 | 8e0aea9d5f1e758e56bfe6c22b407ba7c461d8ce21a0b53d142fd514c633c9b0 |
Close
Hashes for pythonSmallToolsByHanXu-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9113a47b765eef4f2e7597f94eb89b8b7e0ff95bdfdf1e17e3e30806bf27e55 |
|
MD5 | add29cfc83ff1fcae3c075d9d1a00818 |
|
BLAKE2b-256 | f32f475f750057b4c1bee65215cb364270d73ccfd256b6b577b461069f5bf6ba |