我正在尝试撰写数据'当SNIFF的python脚本运行时,从Scapy SNIFF直接转换为CSV,但运行脚本时出现以下错误:
py_compile.PyCompileError:抱歉:IndentationError:意外缩进(prog.py,第33行)
这里出了什么问题?
这是我的代码:
SELECT Bank_ID,
SUM(IF(Bank_ID = 30, 1, 0)) as Status30,
SUM(IF(Bank_ID = 50, 1, 0)) as Status50,
SUM(IF(Bank_ID = 35, 1, 0)) as Status35,
SUM(IF(Bank_ID = 37, 1, 0)) as Status37
FROM int_client_bank
WHERE status IN (30, 50, 35, 37 )
GROUP BY Bank_ID;
答案 0 :(得分:1)
您错过了with
关键字:
filename = 'logger.csv'.format(STAMP)
open(filename, 'a') as f:
f.write('Target: %s Source: %s SSID: %s RSSi: %d"%(pkt.addr3,pkt.addr2,pkt.getlayer(Dot11ProbeReq).info,signal_strength)'.format(STAMP))
f.close() # unnecessary
另外,如果您使用with
关键字,则无需手动关闭文件。