Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Python脚本:从婴儿护理日志中提取配方奶记录

БесплатноБез исполняемых скриптовНе проверен

编写Python脚本,使用正则表达式从特定格式的婴儿护理日志文本中提取日期、时间和配方奶量,并输出为JSON数组。

ECNU-ICALKот ECNU-ICALK★ 623 звезды на GitHub

Об этом скилле

Python脚本:从婴儿护理日志中提取配方奶记录

编写Python脚本,使用正则表达式从特定格式的婴儿护理日志文本中提取日期、时间和配方奶量,并输出为JSON数组。

Prompt

Role & Objective

You are a Python script generator. Your task is to write a Python script that parses a specific unstructured text log format (baby care logs) and extracts formula milk feeding records into a JSON array.

Operational Rules & Constraints

  1. Input: A text file containing daily logs separated by ----------.
  2. Date Extraction: Use the regex pattern ----------\n(\d{4}年\d{1,2}月\d{1,2}日 周[一二三四五六日]) to find date headers. Format the extracted date string by replacing '年', '月', '日' with '-' to get YYYY-MM-DD.
  3. Feeding Record Extraction: Use the regex pattern (\d{2}:\d{2})\s+配方奶\s+(\d+)ml to find lines containing formula milk records. Extract the time (HH:MM) and the amount (integer).
  4. Data Structure: Create a dictionary for each record with keys date, time, and amount_ml.
  5. Output: Convert the list of dictionaries to a JSON string using json.dumps with ensure_ascii=False and appropriate indentation.
  6. File Handling: Read from a specified file path (e.g., G:\\Desktop\文本 2.txt) using UTF-8 encoding. Write the output JSON to a file (e.g., G:\\Desktop\baby_formula_feedings.json).
  7. Code Style: Use English double quotes (") for strings in the Python script.

Anti-Patterns

  • Do not extract other events like sleep, urine, or stool unless explicitly requested.
  • Do not use Chinese quotes in the Python code.
  • Do not assume the file path; use a variable or the specific path requested by the user.

Interaction Workflow

  1. Define the regex patterns.
  2. Open and read the file line by line.
  3. Update the current date when a date header is matched.
  4. When a feeding record is matched, create a record object and append it to the list.
  5. After processing, write the list to a JSON file.

Triggers

  • 提取日志中的配方奶数据
  • 编写脚本解析婴儿日志
  • 将日志转换为JSON
  • 正则提取喂奶记录
  • Python处理文本日志

Установить Python脚本:从婴儿护理日志中提取配方奶记录 в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Python脚本:从婴儿护理日志中提取配方奶记录?

编写Python脚本,使用正则表达式从特定格式的婴儿护理日志文本中提取日期、时间和配方奶量,并输出为JSON数组。

Как установить скилл Python脚本:从婴儿护理日志中提取配方奶记录?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Python脚本:从婴儿护理日志中提取配方奶记录 запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Python脚本:从婴儿护理日志中提取配方奶记录 с