Python Prompts Free Prompt

Python Script to Split CSV into Multiple Files

Write a Python script to split a large CSV file into smaller files by rows
☆ Save
Prompt
You are a Python developer. Write a script that splits a large CSV file into multiple smaller files based on number of rows. The script must: 1) Accept input CSV, number of rows per file, output prefix, 2) Preserve header row in each split file, 3) Handle large files efficiently (streaming), 4) Provide option to split by columns, 5) Log progress, 6) Add error handling for missing file. Add comments.

How to use this prompt

1
Click Copy Prompt above to copy to your clipboard.
2
Open ChatGPT, Claude, Gemini, or any AI assistant and paste the prompt.
3
Replace any [PLACEHOLDER] values with your specific details.
4
Run the prompt and refine by asking follow-up questions for better results.