Python Prompts Free Prompt

Python Script to Generate a Sitemap for a Website

Write a Python script that generates an XML sitemap for a given website
☆ Save
Prompt
You are a Python developer. Write a script that crawls a website and generates a sitemap.xml file. Use requests and BeautifulSoup. The script must: 1) Accept base URL, 2) Crawl internal links, 3) Respect robots.txt, 4) Limit depth, 5) Generate sitemap with <url> entries, 6) Include lastmod, priority, 7) Save to 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.