【发布时间】:2019-09-27 23:26:33
【问题描述】:
import subprocess
json=os.startfile("inputs.json")
json = "C:\Users\Onion1\inputs.json"
subprocess.call([json])
尝试了上述方法,但无法打开和调用子进程。
使用 open("C:\Users\O\ss.txt") 作为输出: subprocess.Popen("ls",stdout=out)
【问题讨论】:
-
你想读取 json 文件并从中执行命令吗?
-
读取一个json文件并在子进程中使用它
-
将 Json 文件作为普通文本文件读取并解析并将其内容传递给子进程调用。能否请您出示您要阅读的 Json 文件
-
{"sender": "AB", "body": "Trade order wall movement quite with want large. Store whose magazine ability so interest artist. Owner federal west.\nIt situation take kid money structure. Throughout may whose much or training", "id2": "2119739392053", "id": "111", "device_id": "9878"}示例 json 包含 1000 个相同格式的 json
标签: python json python-3.x subprocess pipe