Skip to main content

Fp4NT is a file parsing tool specially designed for processing and converting nested tabular data. It supports multiple input formats, such as HTML and Excel, and converts them to Markdown-formatted tables.

Project description

📚 fp4nt —— 嵌套表格解析工具


License

🧰 专为嵌套表格数据设计的解析与转换工具,支持 HTML 和 Excel 转 Markdown 表格


🌟 功能亮点

  • ✅ 支持从 HTML 提取并转换为 Markdown 表格
  • ✅ 支持处理 Excel(.xlsx) 文件中的合并单元格
  • ✅ 自动填充 跨行/跨列空白单元格
  • ✅ 可自定义 填充标记(如“无”)
  • ✅ 简洁的日志系统便于调试

🛠️ 安装方式

pip install fp4nt

或升级至最新版本:

pip install --upgrade fp4nt

🔧 使用方法

1. 初始化对象

from fp4nt import Fp4NT

# 可选参数控制是否填充合并单元格
fp4nt = Fp4NT(row_fill_merged=True, col_fill_merged=False, fill_mark='无')

2. HTML 表格转 Markdown

html = "<table><tr><th>Header1</th><th>Header2</th></tr><tr><td>Data1</td><td>Data2</td></tr></table>"
markdown_output = fp4nt.convert_html_to_markdown(html)
print(markdown_output)

3. Excel 重构 DataFrame(含合并单元格处理)

data_path = '/path/to/your/file.xlsx'
df = fp4nt.build_excel_frame(data_path)
print(df.to_markdown(index=False))

📦 依赖库

确保已安装以下依赖包:

pip install -r requirements.txt

依赖项如下:

包名 版本要求
beautifulsoup4 >=4.9.0
html2text >=2020.1.16
pandas >=1.0.0
openpyxl >=3.0.0

📁 示例文件结构

fp4nt/
├── __init__.py
├── fp4nt.py      # 主模块
└── README.md     # 当前文档

📄 示例输出(Markdown 表格)

输入 HTML:

<table>
  <tr><th>姓名</th><th>年龄</th></tr>
  <tr><td>张三</td><td>25</td></tr>
</table>

输出 Markdown:

| 姓名 | 年龄 |
|------|------|
| 张三 | 25   |

💬 反馈建议 & 报告问题

欢迎在 GitHub Issues 中提交反馈或 bug 报告!


📜 协议

该项目采用 MIT License,请参阅 LICENSE 文件了解更多。


🙌 感谢

感谢你使用 fp4nt!如果你觉得这个工具对你有帮助,欢迎 ⭐ Star、分享给朋友或贡献代码 😊


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

fp4nt-1.1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fp4nt-1.1.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file fp4nt-1.1.1.tar.gz.

File metadata

  • Download URL: fp4nt-1.1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for fp4nt-1.1.1.tar.gz
Algorithm Hash digest
SHA256 40debb21b5df3d0665c46bf7d524da088d493216475249daacd739e507b2f74b
MD5 14f10438f0013f8f922764aed1ffb94a
BLAKE2b-256 aa7767ed574a21f7f3f54184ac05392e984a73b53f09d837d3509b9abf10e15f

See more details on using hashes here.

File details

Details for the file fp4nt-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: fp4nt-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for fp4nt-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 647dd6d946ed64090e91a49e3fa1ea6610070abcc3b8f976351794e7fe8d7b65
MD5 f4b8cfe73f524b7241beca99a27539c0
BLAKE2b-256 16b331a3d66f0cb9f690abafaf7f4123934f6fd3c7ae4a63d6b2c72857ec3b47

See more details on using hashes here.

Supported by

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