根据《检察官办公室行动手册》第12章和《塞萨尔尼》一书,我撰写了《埃尔兰法典》:
Erlang:
p(Param) ->
?DBG("Starting~n", []),
Cmd = "python test.py",
Port = open_port({spawn,Cmd}, [stream,{line, 1024}, exit_status]),
?DBG("Opened the port: ~w~n", [Port]),
Payload = term_to_binary(list_to_binary(integer_to_list(Param))),
erlang:port_command(Port, Payload),
?DBG("Sent command to port: ~w~n", [Payload]),
?DBG("Ready to receive results for command: ~w~n", [Payload]),
receive
{Port, {data, Data}} ->
?DBG("Received data: ~w~n", [Data]),
{result, Text} = binary_to_term(Data),
Blah = binary_to_list(Text),
io:format("~p~n", [Blah]);
Other ->
io:format("Unexpected data: ~p~n", [Other])
end.
粉碎
import sys
def main():
while True:
line = sys.stdin.readline().strip()
if line == "stop-good":
return 0
elif line == "stop-bad":
return 1
sys.stdout.write("Python got ")
sys.stdout.write(line)
sys.stdout.write("
")
sys.stdout.flush()
if __name__ == "__main__":
sys.exit(main())
《埃兰法》在重新适用条款时暂停适用,它从来就得不到任何信息。
我也从一个常规的六氯环己烷中检查了沙捞越,它印刷了每个用户的投入(1-Python got 1)。
这里的错误在哪里? 我的埃兰法为什么回头?