Jeff McNeil wrote:
> The raw_input built-in returns a string. The '[0]' subscript returns
> the first character in the user supplied response as strings support
> indexing.
>
> [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
> Type "help", "copyright", "credits" or "license" for more info
On Fri, 13 Jul 2007 14:51:52 -0400, "Jeff McNeil" <[EMAIL PROTECTED]>
wrote:
>The raw_input built-in returns a string. The '[0]' subscript returns
>the first character in the user supplied response as strings support
>indexing.
>
>[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
>Type "hel
On Fri, Jul 13, 2007 at 06:35:16PM -, [EMAIL PROTECTED] 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 raw_input built-in returns a string. The '[0]' subscript returns
the first character in the user supplied response as strings support
indexing.
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> mystr = "asdf"
>>>
what does the statement "choice = raw_input(prompt)[0]" mean? I don't
know why there is a '[0]' in the statement.
Thank you very much
--
http://mail.python.org/mailman/listinfo/python-list