Use a linter, personally pylint has helped me learn to write more "Pythonic" code. If you're using vscode, you can easily integrate it or any other python linter.
https://learn.microsoft.com/en-us/visualstudio/python/lintin...
If you also want a linter for bash, check out shellcheck: https://github.com/koalaman/shellcheck