[Tutor] reading strings

Charles Takacs genius@idirect.com
Sun, 10 Sep 2000 12:02:31 -0400


ankban4@indya.com wrote:
> 
> Hi,
>     I am new to python (1 day).I have downloaded the python for
> windows platform ver 1.5. Well i was tinkering around with it for
> some time reading the tutorial that came along with it . Well , i
> couldnt figure out 1 thing . How do i input  strings in python?
> In other words what is the python equivalent of the followig piece of
> code :-
> print "Whats your name?";#perl code
> $name=<STDIN>;
> chomp($name);
> ****************************************
> print "Whats your name?"; /* C code */
> gets(name);/* name[10] defined earlier */
> 
> i  tried with input but with no success.
> Thanks for answering a newbie question.
> ankur
> 
> Enter your default signature here
> Sent by Indya Messaging Service
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor

If you really looked into the Tutorial, you could have very easily found
the answer.  It's very clear about the difference between "Input and
Raw_input".
Here is your answer:

name=raw_input("What's your name? ");
print name

You should look it some of the other Tutorials found on the Python.org
website. I am sure you will find them very beneficial.

BTY: According to my experience as a Newbie; The Python gurus treat us
very well, however they do expect so demonstration of initiatives.

Best regards
Charles