Open the file from Files
Keep the Python file in a location available through iOS Files, then open it with a code-aware editor rather than a general note-taking app.
Indentation matters
Python uses indentation as part of its syntax, so automatic indentation is particularly useful when editing on a phone keyboard.
Use mobile editing for focused changes
Updating a constant, correcting a function, reviewing code, adding comments or changing text is comfortable on mobile. Larger refactors are usually easier with a full keyboard and development environment.
Running code is a separate step
Editing a .py file and executing Python are different tasks. Developer File Editor is focused on opening, modifying and saving source files.
Keep backups or use version control when changing important code, regardless of which editor you use.