Hello,

I want to read from the standard input numbers until i reach a certain value
or to the end of the "file".
What is the simplest, straightforward, pythonic way to do it?

a sketch of how i tried to do it:
[code]
while 1 < 2:
    x = raw_input()
    if type(x) != int or x == 11:
        break
    else:
        print x
[/code]

but don't work. and i'm interest in a general way to read until it is
nothing to read.


to ilustrate that in C:
[code]
int x;
while( scanf("%d",&x) == 1 && x != 11)
             printf("%d\n", x);
[/code]


Thanks!
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to