skazhy a écrit :
hi, i am new to python, so i've a really simple question about
dictionaries.
if i have a dictionary and I make have an input after it (to input
numbers) can i get the key of value that was in input?
What if many keys are associated with a same value, ie:
d = {'a
On Jul 21, 8:14 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jeff wrote:
> > throw KeyError('%s not found' % str(val))
>
> "throw"? and shouldn't that be a ValueError? ;-)
>
>
Whoops. Been working in too many different languages at the same
time :).
--
http://mail.python.org/mailman/listinf
On Jul 21, 8:14 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jeff wrote:
> > throw KeyError('%s not found' % str(val))
>
> "throw"? and shouldn't that be a ValueError? ;-)
>
>
Whoops. Been working in too many different languages at the same
time :).
--
http://mail.python.org/mailman/listinf
Jeff wrote:
throw KeyError('%s not found' % str(val))
"throw"? and shouldn't that be a ValueError? ;-)
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 21, 7:35 am, skazhy <[EMAIL PROTECTED]> wrote:
> hi, i am new to python, so i've a really simple question about
> dictionaries.
> if i have a dictionary and I make have an input after it (to input
> numbers) can i get the key of value that was in input?
>
>
skazhy wrote:
hi, i am new to python, so i've a really simple question about
dictionaries.
if i have a dictionary and I make have an input after it (to input
numbers) can i get the key of value that was in input?
A dictionary contains (key, value) pairs, and is optimized for quickly
fi
Sounds like a school assignment. Find the answer yourself here:
http://diveintopython.org/toc/index.html
You'll learn a lot more in the process.
2B
--
http://mail.python.org/mailman/listinfo/python-list
hi, i am new to python, so i've a really simple question about
dictionaries.
if i have a dictionary and I make have an input after it (to input
numbers) can i get the key of value that was in input?
somehting like this:
dict = { "key1"=100,"key2"=200,"key3"
Chris wrote:
> Is there a way to stop this behavior? I want to process this dictionary
> in the order it's in, element by element. I'm running Python 2.3, if
> that helps.
As said previously, you either want a list (which are ordered), or an
ordered-dictionary (not a Python native type, see
http:/
"Chris" <[EMAIL PROTECTED]> writes:
> Is there a way to stop this behavior? I want to process this dictionary
> in the order it's in, element by element. I'm running Python 2.3, if
> that helps.
You want a list not a dictionary.
--
http://mail.python.org/mailman/listinfo/python-list
When you declare a dictionary, Python puts it in a different order than
the way you declare it:
>>> stuff = {'\n':'', ':'\n'}
>>> print stuff
{'':'\n', '\n':''}
Is there a way to stop this behavior? I want to process this dictionary
in the order it's in, element by element. I'm running Python 2.3
11 matches
Mail list logo