<p>python cloudant库有一个上下文管理器来简化对文档的处理:</p>
<blockquote>
<pre><code># Upon entry into the document context, fetches the document from the
# remote database, if it exists. Upon exit from the context, saves the
# document to the remote database with changes made within the context.
with Document(database, 'julia006') as document:
# The document is fetched from the remote database
# Changes are made locally
document['name'] = 'Julia'
document['age'] = 6
# The document is saved to the remote database
</code></pre>
<p>Source: <a href="http://python-cloudant.readthedocs.io/en/latest/document.html" rel="nofollow noreferrer">http://python-cloudant.readthedocs.io/en/latest/document.html</a></p>
</blockquote>
<p>如果远程文档不存在,该行为是什么?文档是否设置为<code>None</code>,或者是否引发异常?你知道吗</p>