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'}
> 
for k in a:
   if a[k] is None:
     a[k] = 'Null'

You aren't doing this to create SQL statements, are you? If so, 
parameterized queries are the way to go ...

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to