En Thu, 12 Apr 2007 05:20:58 -0300, 7stud <[EMAIL PROTECTED]> escribió:
> I can't break out of the for loop in this example: > > ------ > import sys > > lst = [] > for line in sys.stdin: > lst.append(line) > break > > print lst > ----------- Python 2.5.1c1 (r251c1:54692, Apr 5 2007, 09:19:18) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. py> import sys py> lst = [] py> for line in sys.stdin: ... lst.append(line) ... break ... hola que tal como estan ^Z py> print lst ['hola\n'] ----------- I typed many lines, but lst contains only one item, as expected. Same as your regular file example: the file contains many lines, but only the first goes into the list. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list