跳到正文

个人记录

一个 IO 交互调试器

5ab_juruo约 1 分钟
原文
文章信息与版本

文章信息

发布
2022年9月28日
收录
2026年10月8日
更新
2026年11月11日
篇幅
约 1 分钟

版本

  1. v1当前
Python
from subprocess import PIPE, Popen
from sys import argv

p1 = Popen(argv[2], stdin = PIPE, stdout = PIPE, text = True, universal_newlines = True)
p2 = Popen(argv[1], stdin = p1.stdout, stdout = p1.stdin, text = True, universal_newlines = True)

p1.wait()
p2.wait()

保存为 interactor.py,使用的时候直接 interactor.py <grader_name> <contestant_name> 即可。

需要 grader 在错误流/文件里面输出交互结果。

原文
存档评论5 条抓取于