Skip to main content

文本文件合并、分割小模块:练习用。

Project description

tfmcutil

介绍

文本文件合并、分割模块:练习用的小模块。

模块结构

tfmcutil 模块包含一个 TextFiles 类,文件的分割、合并通过该类实例的 sizedfiles、onefile 方法完成。

安装教程

python3 -m pip install tfmcutil

使用说明

# 假设以下文件都存在且路径正确
from tfmcutil import TextFiles

f1 = TextFiles(("test.txt", "utf-8"))
f2 = TextFiles("test1.txt", ("test2.txt", "ascii"))
f3 = f1 + f2

print(len(f3)) # 实例中包含的文件数

print(f3.items()) # 实例中所有的 (文件路径, 编码) 元组

f3.onefile("result.txt") # 合并成一个文件

f3.sizedfiles(1000, "sized.txt") # 按字符数分割成多个文件, sized_1.txt、sized_2.txt ...

f4 = TextFiles.fromstring("测试内容\n第二行测试内容", "new.txt") # 将字符串写入 "new.txt" 并保存,返回 TextFiles 实例

f5 = f4 + f1

print(f5.totalsize()) # 返回实例中所有文件大小总和,单位字节

# 更多请查看源代码或 help(TextFiles)

参与贡献

  1. Fork 本仓库
  2. 新建 feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

特技

  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

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

tfmcutil-0.0.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

tfmcutil-0.0.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file tfmcutil-0.0.2.tar.gz.

File metadata

  • Download URL: tfmcutil-0.0.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for tfmcutil-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6bbe50bfc95d3a52049137789f68cd07b0c880dba2d64c3c371b22948751e27d
MD5 4ab5aa02dea4f2541f3df1f174e8eff0
BLAKE2b-256 ee56539dd25fbc85632dfc0c615b81035fd4902cd15a463cff5b7456f78cc3b3

See more details on using hashes here.

File details

Details for the file tfmcutil-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tfmcutil-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.9

File hashes

Hashes for tfmcutil-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7d0d7aaa4e29e43022f40dd6c0afb77df3268cd7237ad50545c752ca7fe49c05
MD5 d0db9adb325b669259d9df62db5b4e41
BLAKE2b-256 9b032e1bd145179093f5434f48ec2f5d1496356fb2c3542565ff3dae87d91b09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page