A Python newbie ask a simple question

Christoph Haas email at christoph-haas.de
Fri Jul 13 20:52:49 CEST 2007


On Fri, Jul 13, 2007 at 06:35:16PM -0000, xing93111 at gmail.com wrote:
> what does the statement "choice = raw_input(prompt)[0]" mean? I don't
> know why there is a '[0]' in the statement.

It calls the "raw_input" function with the argument of "prompt". That
function returns a list and you are getting the first ([0]) value from
that list.

Cheers
 Christoph




More information about the Python-list mailing list