Blog: 2024-02-13: Difference between revisions

From razwiki
Jump to navigation Jump to search
(Created page with "How does this work but it doesn't seem to when you use the read and write methods on the io objects? <pre> proc = subprocess.Popen(['bc'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) os.write(proc.stdin.fileno(), b'100+200\n') print(os.read(proc.stdout.fileno(), 4096)) </pre>")
(No difference)

Revision as of 01:59, 13 February 2024

How does this work but it doesn't seem to when you use the read and write methods on the io objects?

proc = subprocess.Popen(['bc'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
os.write(proc.stdin.fileno(), b'100+200\n')
print(os.read(proc.stdout.fileno(), 4096))