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.2.tar.gz (7.0 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.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fp4nt-1.1.2.tar.gz
  • Upload date:
  • Size: 7.0 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.2.tar.gz
Algorithm Hash digest
SHA256 405ae9b863366995bd04939f70116da23b4457a5186edce6485ec5458c0b00d7
MD5 101b41ea6861cb2d919facb7a35f118c
BLAKE2b-256 4128e25184d08f85d36afe6dec5bebcd26fda86260d73ed954297105b9161e7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fp4nt-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a9b88098e76c58853a5051b3dbc3ed253df0f842bcacc21ba24895f26d0377a
MD5 54b42ccee436147fb14675cf87a2cda8
BLAKE2b-256 cc5f72ea6cb301f7d34d2f57df1bc5bcd5a143e592a8178c21a532c44edbe0dd

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