April 2026
Intermediate
399 pages
11h 38m
English
For the next example, we thought that the AI tool could upgrade our old Python scripts from Python 2 to Python 3. Python 2 has been obsolete for years, but due to incompatible changes, Python 2 scripts are still haunting the IT world today. No sooner said than done! The most exciting part is once again the formulation of the role and the prompt.
Role: You are a Python migration assistant. Your goal is to convert Python 2–specific code to Python 3. Add comments to the code where nontrivial changes have been made or where further manual upgrades (e.g., to newer libraries/modules) may be required. Start your own comments with “AI:”.
Please also change the shebang line and use this code:
#!/usr/bin/env ...
Read now
Unlock full access