Re: How to replace all None values with the string Null in a dictionary

2005-10-29 Thread Bruno Desthuilliers
dcrespo a écrit : I think it would be time for you to read the Fine Manual... hi, thanks for your answer... I really did it the same way you suggested, but I forgot to tell you that I wanted to get a better way for doing it. Let us know if you find one... By the way, knowing your

Re: How to replace all None values with the string Null in a dictionary

2005-10-28 Thread bruno at modulix
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:

Re: How to replace all None values with the string Null in a dictionary

2005-10-28 Thread dcrespo
I think it would be time for you to read the Fine Manual... hi, thanks for your answer... I really did it the same way you suggested, but I forgot to tell you that I wanted to get a better way for doing it. By the way, knowing your wisdom, what do I have to install to get the following code

Re: How to replace all None values with the string Null in a dictionary

2005-10-28 Thread dcrespo
Thanks... I did it right that way, but asked it without telling how I did it just to see what are the occurences of others. I thing there's no better/faster solution. Many thanks Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: How to replace all None values with the string Null in a dictionary

2005-10-28 Thread Steven D'Aprano
On Fri, 28 Oct 2005 05:23:00 -0700, dcrespo wrote: I think it would be time for you to read the Fine Manual... hi, thanks for your answer... I really did it the same way you suggested, but I forgot to tell you that I wanted to get a better way for doing it. What was wrong with the way you

How to replace all None values with the string Null in a dictionary

2005-10-27 Thread dcrespo
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'} Thanks Daniel -- http://mail.python.org/mailman/listinfo/python-list

Re: How to replace all None values with the string Null in a dictionary

2005-10-27 Thread skip
Daniel How can I replace all None values with the string 'Null' in a Daniel dictionary? a = {'item1': 45, 'item2': None} for key in a: if a[key] is None: a[key] = Null Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: How to replace all None values with the string Null in a dictionary

2005-10-27 Thread Steve Holden
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

Re: How to replace all None values with the string Null in a dictionary

2005-10-27 Thread Mike Meyer
dcrespo [EMAIL PROTECTED] writes: Hi all, How can I replace all None values with the string 'Null' in a dictionary? Iterate over everything in the dictionary: for key, item in mydict.items(): if item is None: mydict[key] = 'Null' mike -- Mike Meyer [EMAIL PROTECTED]

Re: How to replace all None values with the string Null in a dictionary

2005-10-27 Thread Bengt Richter
On Thu, 27 Oct 2005 16:46:32 -0400, Mike Meyer [EMAIL PROTECTED] wrote: dcrespo [EMAIL PROTECTED] writes: Hi all, How can I replace all None values with the string 'Null' in a dictionary? Iterate over everything in the dictionary: for key, item in mydict.items(): if item is None:

Re: How to replace all None values with the string Null in a dictionary

2005-10-27 Thread Alex Martelli
Bengt Richter [EMAIL PROTECTED] wrote: ... Which is probably more efficient than one-liner updating the dict with mydict.update((k,'Null') for k,v in mydict.items() if v is None) ...which in turn is probably better than _auxd = {None: Null} newd = dict((k, _auxd.get(k, c) for k, c in