Example result: Python script to automate a task
AI-generated example · Automation Script
Updated

Python script to automate a task

This prompt writes a Python script for a task you describe. You give the input, the output you want and your skill level, and it produces a script you can run. Read it before running it on important files.

text-python-script-helper — chatgpt — 68 words

Write a Python script to automate this task.

Task: [e.g. rename files by date, merge CSVs, send daily email]
Input: [FILE TYPE / LOCATION]
Output: [WHAT I WANT]
My skill level: [BEGINNER]
OS: [WINDOWS / MAC]

Keep the code simple and commented. Explain how to install what is needed, how to run it, and add a dry-run mode so it does not change anything on the first try.

Test on copies of your files first.

Get a better result

What you will get

A simple, commented Python script for your task, with install steps, how to run it and a dry-run mode that shows what it would do without changing any files on the first try.

Common mistake

The script changes files straight away.

Fix: Keep the dry-run requirement, run it first and read the printout. Work on copies, as the tip says.

Also watch for
  • It needs libraries you do not have. State your operating system and skill level, and ask for steps using only the standard library where possible.
  • An error appears and you are stuck. Paste the whole error message, plus the line it points to, and ask for the cause and a fix.
Try a variation: make it run daily

Ask how to schedule the script to run every morning on your system, with the exact steps for Windows or Mac and how to stop it.

Still not right? Reply with this

Add a dry-run flag that only prints what it would do, and a log file listing every action taken when it runs for real.

Guides that use this prompt

More chat & writing prompts

See all 465 →