basic question, sorry

s_gherman at yahoo.com s_gherman at yahoo.com
Mon Aug 21 01:39:37 EDT 2000


Hi, I'm a Python beginner.

I need to build a dictionary {} which maps strings to lists.
Let's say I need to map incrementally:
dict['one'] = ['1']
dict['one'].append('I')
etc

How can I check that dict[n] exists or not already?

I tried:
1) if not dict[n]
2) if dict[n] == None

Thanks in advance,
Sorin Gherman


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list