Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99310
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-11-24 02:47 -0800 |
| References | <133829df-f57f-442f-9dbf-b22b22f656ae@googlegroups.com> <mailman.98.1448360068.2291.python-list@python.org> <45b60b80-d6b7-423e-93b9-2ef4977fb368@googlegroups.com> <mailman.100.1448361611.2291.python-list@python.org> |
| Message-ID | <16cbc004-c22f-492d-9f75-94e14374616d@googlegroups.com> (permalink) |
| Subject | Re: Returning a result from 3 items in a list |
| From | Cai Gengyang <gengyangcai@gmail.com> |
Yup, thanks a lot ... it works now !
>>> results = {
"gengyang": 14,
"ensheng": 13,
"jordan": 12
}
>>> results["jordan"]
12
On Tuesday, November 24, 2015 at 6:40:26 PM UTC+8, Peter Otten wrote:
> Cai Gengyang wrote:
>
> > Strange, it gives me an error message when i type result["jordan"] or
> > result[max(result)] though :
> >
> >>>> results = {
> > "gengyang": 14,
> > "ensheng": 13,
> > "jordan": 12
> > }
> >
> >>>> result["jordan"]
> > Traceback (most recent call last):
> > File "<pyshell#27>", line 1, in <module>
> > result["jordan"]
> > NameError: name 'result' is not defined
>
> Yeah, the error message really should be
>
> "NameError: name 'result' is not defined; did you mean 'results'?"
>
> ;)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:04 -0800
Re: Returning a result from 3 items in a list Chris Angelico <rosuav@gmail.com> - 2015-11-24 21:14 +1100
Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:27 -0800
Re: Returning a result from 3 items in a list Peter Otten <__peter__@web.de> - 2015-11-24 11:35 +0100
Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 02:47 -0800
Re: Returning a result from 3 items in a list Chris Angelico <rosuav@gmail.com> - 2015-11-24 22:05 +1100
Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-24 03:06 -0800
Re: Returning a result from 3 items in a list Peter Otten <__peter__@web.de> - 2015-11-24 11:32 +0100
Re: Returning a result from 3 items in a list Denis McMahon <denismfmcmahon@gmail.com> - 2015-11-24 14:07 +0000
Re: Returning a result from 3 items in a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-24 14:28 +0000
Re: Returning a result from 3 items in a list Ned Batchelder <ned@nedbatchelder.com> - 2015-11-24 08:59 -0800
Re: Returning a result from 3 items in a list Cai Gengyang <gengyangcai@gmail.com> - 2015-11-25 02:26 -0800
Re: Returning a result from 3 items in a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-11-25 11:22 +0000
csiph-web