How to resolve "IndentationError: unexpected indent"

How to resolve "IndentationError: unexpected indent"

我是 运行ning Kali Linux 并且需要完成大量命令,但我正在制作一个脚本来真正加快我的速度。这是 .py 文件:

import os

if raw_input("Begin fake Access Point? (y/n): ")=="y":
 os.system(airmon-ng)

interface = input("Enter your Interface name: ")
 os.system(airmon-ng "interface" start)

我在尝试 运行 时遇到此错误:

  File "WNS.py", line 7
    os.system(airmon-ng "interface" start) 
    ^
IndentationError: unexpected indent

一开始尝试删除空格,但后来出现此错误:

IndentationError: expected an indented block

缩进在Python中非常重要。解释器使用它来了解如何将 instructions.The 参数块分隔为 os.system() 调用看起来也不好。不管怎样,这就是它应该的样子

import os

if raw_input("Begin fake Access Point? (y/n): ")=="y":
    os.system("airmon-ng")

interface = input("Enter your Interface name: ")
os.system("airmon-ng "+interface+" start")