简体   繁体   English

如何解决“ IndentationError:意外缩进”

[英]How to resolve “IndentationError: unexpected indent”

I'm running Kali Linux and need to pull off a load of commands but I'm making a script to really speed that up for me. 我正在运行Kali Linux,需要卸载大量命令,但是我正在编写脚本来真正为我加快速度。 Here is the .py file: 这是.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)

I'm getting this error when trying to run it: 尝试运行时出现此错误:

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

Tried to remove the whitespace in the beginning but then I just get this error: 试图在一开始就删除空格,但随后我得到此错误:

IndentationError: expected an indented block

Indendation is very important in Python. 内在化在Python中非常重要。 It is used by the interpreter to know how to delimit blocks of instructions.The parameters to the os.system() call don't look good either. 解释器使用它来知道如何分隔指令块。os.system()调用的参数也不是很好。 Anyway this is how it's supposed to look like 无论如何,这应该是什么样子

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")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM