string % dictionary question

Sam Sungshik Kong ssk at chol.nospam.net
Mon Sep 13 20:10:33 EDT 2004


Hello, group!

<code>
>>> di={}
>>> di["test"]=None
>>> s="%(test)s" % di
>>> s
'None'
</code>

I want the result to be just empty string when the dictionary value is None.
Is there a good way?

TIA.
Sam





More information about the Python-list mailing list