Python Automation

👤 ericlooi504 📦 v1.0.0 ⭐ 4.3 ⬇️ 830 下載
💻 開發程式設計 免費

📖 技能介紹


name: python-automation description: "Full-stack Python automation toolkit for file processing, data extraction, PDF manipulation, Excel/workbook automation, web scraping, and system tasks. Use when the user needs to: (1) Process/rename/organize files in bulk, (2) Extract data from PDFs, CSVs, or web pages, (3) Generate or modify Excel reports, (4) Automate repetitive system tasks (cron, file watching), (5) Build quick CLI tools for data processing."

發現更多技能外掛,請訪問7w4.net。


Python Automation

Core Libraries Quick Reference

Task Library Installation
File system pathlib, shutil, os stdlib
CSV csv stdlib
Excel openpyxl pip install openpyxl
Excel (old) xlrd / xlwt pip install xlrd xlwt
PDF text PyMuPDF (fitz) pip install PyMuPDF
PDF tables camelot-py / tabula-py pip install camelot-py
Web scraping requests + BeautifulSoup4 pip install requests beautifulsoup4
Browser automation playwright or selenium pip install playwright
CLI argparse (stdlib) or click stdlib / pip install click
Rich terminal rich pip install rich
File watching watchdog pip install watchdog
Scheduling schedule or cron pip install schedule

Common Patterns

1. Batch File Processing

from pathlib import Path

for f in Path(".").glob("**/*.txt"):
    content = f.read_text()
    # transform content
    f.write_text(content)

2. CSV Read/Write

import csv
with open("input.csv", newline="") as f:
    reader = csv.DictReader(f)
    for row in reader:
        print(row["column_name"])

with open("output.csv", "w", newline="") as f:
    writer = csv.writer(f)
    writer.writerow(["col1", "col2"])
    writer.writerow(["val1", "val2"])

3. Excel Generation

from openpyxl import Workbook
wb = Workbook()
ws = wb.active
ws["A1"] = "Hello"
ws["B1"] = 42
wb.save("output.xlsx")

4. Web Scraping

import requests
from bs4 import BeautifulSoup

resp = requests.get("https://example.com", timeout=10)
soup = BeautifulSoup(resp.text, "html.parser")
for link in soup.select("a[href]"):
    print(link["href"], link.text.strip())

Scripts

See scripts/ for ready-to-use automation scripts: - rename_batch.py — Batch rename files with pattern matching - csv_to_excel.py — Convert CSV files to Excel workbooks

Reference Files

🤖 AI 評測

這個Skill質量較好,內容全面且實用,適合日常Python自動化任務。程式碼示例豐富、可直接執行,指令碼拿來就能用。不足之處是某些邊界情況(如檔案損壞、編碼錯誤)缺少處理指引,部分高階功能尚有欠缺,對新手不太友好。總體而言是一個實用的工具包,但使用時要留意自行處理異常情況。

📊 多維度評分

適應性3.6
規範性4
有效性4.7
可靠性4.2
可信度4.8

📁 包含檔案 (6 個)

📄 SKILL.md 2.6 KB
📄 _meta.json 136 B
📄 references/pandas.md 1.5 KB
📄 references/pdf.md 1.6 KB
📄 scripts/csv_to_excel.py 2.4 KB
📄 scripts/rename_batch.py 2.9 KB