input of data from keyboard

Adam 'Vonlia' Seyfarth adam.seyfarth at home.com
Tue Aug 21 20:40:34 EDT 2001


On Tue, 21 Aug 2001, Rajarshi Guha wrote:

> Hi,
>   what function can I use to get input from the keyboard (or stdin)?

(I'm surprised nobody responded sooner...) You can use the input()
function, or raw_input() function

>>> print input.__doc__
input([prompt]) -> value

Equivalent to eval(raw_input(prompt)).
>>> print raw_input.__doc__
raw_input([prompt]) -> string

Read a string from standard input.  The trailing newline is stripped.
If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.
On Unix, GNU readline is used if enabled.  The prompt string, if given,
is printed without a trailing newline before reading.
>>>


HTH


-- 
     Thanksgiving is coming on the 4th of July
     In the form of a girl with a needle in her eye...
               -- The Butt Hole Surfers: The Lord is a Monkey

   /||  Adam Seyfarth   <http://members.home.net/adam.seyfarth/>  ||\
  /«||  <mailto:cloud at users.sf.net>       Geekcode, version 3.12  ||»\
  \«||  GU d-- s+: a---- C++ UL+>++ P-- L++ E-- W++ N++ o K- w--  ||»/
   \||  O M- V- PE- Y PGP- t 5 X R tv+ b+ DI+ D+ G e-- h! !r !y+  ||/




More information about the Python-list mailing list