python系统argv[1] 列表索引超出范围

2024-10-02 08:28:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用php发送数据,用python获取数据。但shell_exec无法发送参数。我不明白问题出在哪里。this does not fix my error

这是我的php文件

    <?php
    if(isset($_POST["username"])){
        $nick = $_POST["username"];
    echo $nick;//prints ozan to webpage
  $res = shell_exec("C:\Python27\python.exe C:\wamp\www\MLWebsite\website\new.py '".$nick."'");
        echo $res;
    }
    ?>

在新建.py在

^{pr2}$

错误

Content-Type: text/html

Traceback (most recent call last): File "C:\wamp\www\MLWebsite\website\new.py", line 15, in x = sys.argv1 IndexError: list index out of range

请帮我解决这个问题


Tags: pyechonewwwwusernamereswebsiteshell

热门问题