我的代码没有正确的缩进
if age > 18:
if salary > 100000:
print('success')
elif salary < 50000:
print('fail')
else:
print('get_more_info')
else:
print('fail')
我需要
if age > 18:
if salary > 100000:
print('success')
elif salary < 50000:
print('fail')
else:
print('get_more_info')
else:
print('fail')
我尝试使用
exec(autopep8.fix_code(str))
但是我收到了错误
File "<string>", line 3
print('success') elif salary < 50000: print('fail') else: print('get_more_info') else: print('fail')
^
SyntaxError: invalid syntax
我还尝试使用reindent.py
但它返回
File "code_file.py", line 1
if age > 18: if salary > 100000: print('success') elif salary < 50000: print('fail') else: print('get_more_info') else: print('fail')
^
SyntaxError: invalid syntax
我该如何解决这个问题并自动完成?