Jump to content

Talk:Python Programming/Input and Output

Page contents not supported in other languages.
Add topic
From Wikibooks, open books for an open world
Latest comment: 13 years ago by 194.82.177.16 in topic Problem?

A very reasonable code on this page:

import sys for line in sys.stdin:

 print line,

but here is what I am getting back:

   for line in sys.stdin :

IOError: [Errno 9] Bad file descriptor

?????

Problem?

[edit source]

Is this guide out of date or something, cause when I put in "print raw_input 'What is your name?'" in my Python3.0 command line, it returns a syntax error.

Yes, somewhat. It has a note saying that in Python 3.x, you need to use "input" instead of "raw_input". I'm having a problem with EOFError instead of syntax error. It mentions that it happens if it terminates prematurely, but I don't know how to not make it end prematurely? 194.82.177.16 (discuss) 09:38, 17 October 2011 (UTC)Reply