用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/cxcscmu/SkillLearnBench --skill python-csv-generation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | python-csv-generation |
| description | Generate structured CSV files from Python data using the csv module for tabular data export. |
The Python csv module provides functionality to read and write CSV (Comma-Separated Values) files. CSV is a standard format for tabular data that's widely compatible with spreadsheet applications.
Built-in to Python, no installation needed.
import csv
# Data to write
data = [
{'frame_id': '/root/keyframes_001.png', 'coins': 5, 'enemies': 2, 'turtles': 1},
{'frame_id': '/root/keyframes_002.png', 'coins': 3, 'enemies': 1, 'turtles': 0},
{'frame_id': '/root/keyframes_003.png', 'coins': 7, 'enemies': 3, 'turtles': 2},
]
# Write to CSV file
with open('output.csv', 'w', newline='') as csvfile:
fieldnames = ['frame_id', 'coins', 'enemies', 'turtles']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
# Write header row
writer.writeheader()
# Write data rows
writer.writerows(data)
import csv
with open('output.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile)
# Write header
writer.writerow(['frame_id', 'coins', 'enemies', 'turtles'])
# Write data rows
writer.writerow(['/root/keyframes_001.png', 5, 2, 1])
writer.writerow(['/root/keyframes_002.png', 3, 1, 0])
import csv
import os
from pathlib import Path
def write_counting_results(results, output_path):
"""
Write object counting results to CSV.
Args:
results: List of dicts with keys:
'frame_id', 'coins', 'enemies', 'turtles'
output_path: Path to output CSV file
"""
fieldnames = ['frame_id', 'coins', 'enemies', 'turtles']
with open(output_path, 'w', newline='') as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(results)
print(f"Results written to {output_path}")
# Example usage
results = [
{
'frame_id': '/root/keyframes_001.png',
'coins': 5,
'enemies': 2,
'turtles': 1
},
{
'frame_id': '/root/keyframes_002.png',
'coins': 3,
'enemies': 1,
'turtles': 0
}
]
write_counting_results(results, '/root/counting_results.csv')
newline='' when opening CSV files to handle line endings correctlycsv.DictReader to read back CSV files as dictionariesimport csv
with open('output.csv', 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
print(row) # Each row is a dictionary
newline='' parameterencoding='utf-8' if neededquoting=csv.QUOTE_MINIMAL for automatic quoting