I'm wondering if there's a way to open standard I/O as a stream, so I can write and read character by character. Something like

handle = open(stdio)

Any ideas?

sys.stdin is an "always open" file handle to the stdin and likewise sys.stdout. To use them, import sys.