Python 版 mask-pii

用於在日誌與資料管線中遮罩電子郵件與電話 PII 的 Python 實作。

電子郵件遮罩

在保留網域可見性的同時遮罩本地部分。

電話遮罩

在保留格式與後四位可見性的同時遮罩敏感數字。

Builder 風格 API

在處理前明確啟用電子郵件/電話遮罩與遮罩字元。

安裝與開始使用

Python [published: PyPI 0.2.0]: 使用下方目前的安裝方式,載入 Python API 並執行最小範例。此範例會明確啟用電子郵件與電話號碼遮罩,並顯示預期輸出。

安裝

pip install mask-pii

用法

example.py
from mask_pii import Masker

masker = (
    Masker()
    .mask_emails()
    .mask_phones()
    .with_mask_char("#")
)

input_text = "Contact: alice@example.com or 090-1234-5678."
output = masker.process(input_text)

print(output)
# => "Contact: a####@example.com or ###-####-5678."
提示

請檢視 README ,以取得此語言對應的套件生態與 API 範例詳情。

上一頁

語言索引

下一頁

GitHub