Readling all input from stdin

Tyler Eaves tyler at scalegen.com
Mon Jul 28 13:10:38 EDT 2003


#NB: Not tested. There are probably better ways to do this.

import sys
def emulate_readlines():
    data = sys.stdin.read()
    lines = data.split('\n')
    l2 = []
    for line in lines:
        l2.append(line+'\n') #Tack the newline back on...
    return l2

    





More information about the Python-list mailing list