为什么我的编辑器没有给我语法错误,但是编译给了我语法错误

问题描述 投票:0回答:1

我正在使用编辑器PyCharm。它没有给我这个代码的错误

import os
import sys

file = input("What file would you like to read from")

list = open(file, "r")


for line in list:
    command = ("python sqliv.py " + line.strip() + " -e google")
    os.system(command)

编辑器没有给我一个错误,但是当我运行它时,输入后第4行我得到一个错误代码

./dorker: line 4: syntax error near unexpected token `('

当我运行它时,我只是在文件名前面使用“ ./”。

这里是什么问题?如果这样做,是否认为我正在运行Shell脚本?

python syntax
1个回答
1
投票

如果您使用的是Linux,则控制台知道如何执行文本文件的唯一方法是使用shebang。在您的情况下,第一行应为#!/usr/bin/env python3

© www.soinside.com 2019 - 2024. All rights reserved.