node-red执行Python

node-red和python的结合使用,直接就是神器,前端和后端就都有了

图片如下
在这里插入图片描述
见代码



[
    {
        "id": "59d5b15.ad8035",
        "type": "template",
        "z": "eeb650e6.286b2",
        "name": "python content",
        "field": "payload",
        "fieldType": "msg",
        "format": "python",
        "syntax": "mustache",
        "template": "import os\na=os.getcwd()\nprint(a)",
        "output": "str",
        "x": 380,
        "y": 140,
        "wires": [
            [
                "674727ec.c18738"
            ]
        ]
    },
    {
        "id": "afcb6ff0.29a97",
        "type": "inject",
        "z": "eeb650e6.286b2",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 200,
        "y": 140,
        "wires": [
            [
                "59d5b15.ad8035"
            ]
        ]
    },
    {
        "id": "5bdf8e81.b3b82",
        "type": "exec",
        "z": "eeb650e6.286b2",
        "command": "python C:\\data\\1\\py001.py",
        "addpay": "payload",
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 430,
        "y": 300,
        "wires": [
            [
                "ef46f3bb.2b14f"
            ],
            [],
            []
        ]
    },
    {
        "id": "674727ec.c18738",
        "type": "file",
        "z": "eeb650e6.286b2",
        "name": "",
        "filename": "C:\\data\\1\\py001.py",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 590,
        "y": 140,
        "wires": [
            [
                "73781b8.e38c0e4"
            ]
        ]
    },
    {
        "id": "73781b8.e38c0e4",
        "type": "delay",
        "z": "eeb650e6.286b2",
        "name": "",
        "pauseType": "delay",
        "timeout": "2",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 380,
        "y": 240,
        "wires": [
            [
                "5bdf8e81.b3b82"
            ]
        ]
    },
    {
        "id": "ef46f3bb.2b14f",
        "type": "debug",
        "z": "eeb650e6.286b2",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 630,
        "y": 300,
        "wires": []
    },
    {
        "id": "8eb98748.6f58d8",
        "type": "comment",
        "z": "eeb650e6.286b2",
        "name": "输入python代码进行执行",
        "info": "1.写入python文件\n2.构建文件的程序",
        "x": 230,
        "y": 100,
        "wires": []
    }
]
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值