loop through kwargs in python
<p>I am trying to write things the python way but not sure how to get it right. In the code below, I want to read obj.subject and place it into var subject, also read obj.body and place it into body. First I want to read the kwargs variables and search for keywords within the string to replace, if none exists then move on. </p>

<p>Can anyone help me?</p>

<pre><code>    for key in kwargs:
        subject =    str(obj.subject ).replace('[%s]' % upper(key), kwargs[key])


    for key in kwargs:
        body    =    str(obj.body    ).replace('[%s]' % upper(key), kwargs[key])

    return (subject, body, obj.is_html)
</code></pre>
