编辑器
import tabnanny import tempfile with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f: f.write('def greet():\n print("Hello")\n print("World")\n') fname = f.name try: tabnanny.check(fname) print('No indentation errors found') except tabnanny.NannyNag as e: print(f'Indentation error: {e}')
Indentation error: unindent does not match any outer indentation level