1 / 3
Sep 2008

i have problem in inputting data in programs like BISHOPS that the number of test cases is not determined and you should input until you reach the end of file
and also i dont have read() attrib in sys.stdin but i have readline()
this is very bizzare that all over the web there are many examples of sys.stdin.read() but i dont have it

  • created

    Sep '08
  • last reply

    May '09
  • 2

    replies

  • 236

    views

  • 3

    users

5 months later

Even i am having a similar problem.

I had posted for the problem BASE, where the input has to be read from a file.
In what form has the code to be submitted. What is the name of the file from which the input is read from for submitting the code??

1 month later

$ python
Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.

'read'

, 'readinto', 're
adline', 'readlines', 'seek', 'softspace', 'tell', 'truncate', 'write', 'writeli
nes', 'xreadlines']

stdin.read

help(stdin.read)

Help on built-in function read:

read(...)
read([size]) -> read at most size bytes, returned as a string.

If the size argument is negative or omitted, read until EOF is reached.
Notice that when in non-blocking mode, less data than what was requested
may be returned, even if no size parameter was given.

The function is documented in my first edition of Programming Python which is copyright 1996. I believe the function has been there since at least Python 1.0. There are other ways to read input - know which function does what and figure out which one you really want.