add english readme for python maker

This commit is contained in:
lionsoul2014 2026-02-26 14:08:10 +08:00
parent aef4f91348
commit 132221b494
4 changed files with 55 additions and 13 deletions

View File

@ -69,7 +69,7 @@ For API introductions, usage documentation, and test programs, please refer to t
| --- | --- | --- | --- | | --- | --- | --- | --- |
| [Golang](maker/golang/README.md) | golang xdb generation program | :white_check_mark: | :white_check_mark: | | [Golang](maker/golang/README.md) | golang xdb generation program | :white_check_mark: | :white_check_mark: |
| [Java](maker/java/README.md) | java xdb generation program | :white_check_mark: | :white_check_mark: | | [Java](maker/java/README.md) | java xdb generation program | :white_check_mark: | :white_check_mark: |
| [Python](maker/python) | python xdb generation program | :white_check_mark: | :x: | | [Python](maker/python/README.md) | python xdb generation program | :white_check_mark: | :x: |
| [Csharp](maker/csharp) | csharp xdb generation program | :white_check_mark: | :x: | | [Csharp](maker/csharp) | csharp xdb generation program | :white_check_mark: | :x: |
| [Rust](maker/rust/README.md) | rust xdb generation program | :white_check_mark: | :white_check_mark: | | [Rust](maker/rust/README.md) | rust xdb generation program | :white_check_mark: | :white_check_mark: |
| [C++](maker/cpp) | C++ xdb generation program | :white_check_mark: | :white_check_mark: | | [C++](maker/cpp) | C++ xdb generation program | :white_check_mark: | :white_check_mark: |

View File

@ -68,7 +68,7 @@ API 介绍,使用文档和测试程序请参考如下 `maker` 生成程序下
| --- | --- | --- | --- | | --- | --- | --- | --- |
| [Golang](maker/golang/README_zh.md) | golang xdb 生成程序 | :white_check_mark: | :white_check_mark: | | [Golang](maker/golang/README_zh.md) | golang xdb 生成程序 | :white_check_mark: | :white_check_mark: |
| [Java](maker/java/README_zh.md) | java xdb 生成程序 | :white_check_mark: | :white_check_mark: | | [Java](maker/java/README_zh.md) | java xdb 生成程序 | :white_check_mark: | :white_check_mark: |
| [Python](maker/python) | python xdb 生成程序 | :white_check_mark: | :x: | | [Python](maker/python/README_zh.md) | python xdb 生成程序 | :white_check_mark: | :x: |
| [Csharp](maker/csharp) | csharp xdb 生成程序 | :white_check_mark: | :x: | | [Csharp](maker/csharp) | csharp xdb 生成程序 | :white_check_mark: | :x: |
| [Rust](maker/rust/README_zh.md) | rust xdb 生成程序 | :white_check_mark: | :white_check_mark: | | [Rust](maker/rust/README_zh.md) | rust xdb 生成程序 | :white_check_mark: | :white_check_mark: |
| [C++](maker/cpp) | C++ xdb 生成程序 | :white_check_mark: | :white_check_mark: | | [C++](maker/cpp) | C++ xdb 生成程序 | :white_check_mark: | :white_check_mark: |

View File

@ -1,10 +1,11 @@
# ip2region xdb python 生成实现 :globe_with_meridians: [中文简体](README_zh.md) | [English](README.md)
# ip2region xdb python generation implementation
# 脚本执行 # Script Execution
``` ```
# 切换到python maker 根目录 # cd to the python maker root directory
> python main.py > python main.py
ip2region xdb maker ip2region xdb maker
main.py [command] [command options] main.py [command] [command options]
@ -12,9 +13,10 @@ Command:
gen generate the binary db file gen generate the binary db file
``` ```
# `xdb` 数据生成 # `xdb` Data Generation
Generate the ip2region_v4.xdb binary file via the `python main.py gen` command:
通过 `python main.py gen` 命令生成 ip2region.xdb 二进制文件:
``` ```
➜ python git:(v2.0_xdb) ✗ python main.py gen ➜ python git:(v2.0_xdb) ✗ python main.py gen
main.py gen [command options] main.py gen [command options]
@ -23,16 +25,16 @@ options:
--dst string destination binary xdb file path --dst string destination binary xdb file path
``` ```
例如,使用默认的 data/ip.merge.txt 作为源数据,生成一个 ip2region.xdb 到当前目录: For example, using the default data/ipv4_source.txt as the source data to generate an ip2region_v4.xdb in the current directory:
``` ```
➜ python git:(v2.0_xdb) ✗ python main.py gen --src=../../data/ip.merge.txt --dst=./ip2region.xdb ➜ python git:(v2.0_xdb) ✗ python main.py gen --src=../../data/ipv4_source.txt --dst=./ip2region_v4.xdb
# 会看到一堆输出,最终会看到类似如下输出表示运行结束 # You will see a lot of output; eventually, you will see something like the following output indicating the end of the execution
... ...
2022-07-13 19:58:00,540-root-238-INFO - write done, dataBlocks: 13804, indexBlocks: (683591, 720221), indexPtr: (982904, 11065984) 2022-07-13 19:58:00,540-root-238-INFO - write done, dataBlocks: 13804, indexBlocks: (683591, 720221), indexPtr: (982904, 11065984)
2022-07-13 19:58:00,540-root-63-INFO - Done, elapsed: 3m3s 2022-07-13 19:58:00,540-root-63-INFO - Done, elapsed: 3m3s
``` ```
# `xdb` Data Query and bench Test
# `xdb` 数据查询 和 bench 测试 For query functions and testing based on the xdb format, see ip2region [bindings](../../binding)
基于xdb 格式的查询功能和测试见 [ip2region binding](../../binding)

40
maker/python/README_zh.md Normal file
View File

@ -0,0 +1,40 @@
:globe_with_meridians: [中文简体](README_zh.md) | [English](README.md)
# ip2region xdb python 生成实现
# 脚本执行
```
# 切换到python maker 根目录
> python main.py
ip2region xdb maker
main.py [command] [command options]
Command:
gen generate the binary db file
```
# `xdb` 数据生成
通过 `python main.py gen` 命令生成 ip2region_v4.xdb 二进制文件:
```
➜ python git:(v2.0_xdb) ✗ python main.py gen
main.py gen [command options]
options:
--src string source ip text file path
--dst string destination binary xdb file path
```
例如,使用默认的 data/ipv4_source.txt 作为源数据,生成一个 ip2region_v4.xdb 到当前目录:
```
➜ python git:(v2.0_xdb) ✗ python main.py gen --src=../../data/ipv4_source.txt --dst=./ip2region_v4.xdb
# 会看到一堆输出,最终会看到类似如下输出表示运行结束
...
2022-07-13 19:58:00,540-root-238-INFO - write done, dataBlocks: 13804, indexBlocks: (683591, 720221), indexPtr: (982904, 11065984)
2022-07-13 19:58:00,540-root-63-INFO - Done, elapsed: 3m3s
```
# `xdb` 数据查询 和 bench 测试
基于xdb 格式的查询功能和测试见 ip2region [binding](../../binding)