dcrespo wrote:
> Hi all,
> 
> How can I replace all None values with the string 'Null' in a
> dictionary?
> 
> For example:
> convert this:
> a = {'item1': 45, 'item2': None}
> 
> into this:
> a = {'item1': 45, 'item2': 'Null'}
> 

I think it would be time for you to read the Fine Manual...

for key in a:
  if a[key] is None:
    a[key] = 'Null'


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to