擅长:python、mysql、java
<p><a href="https://docs.python.org/3/library/functions.html#print" rel="nofollow noreferrer"><strong>^{<cd1>}</strong> [Python-doc]</a>函数不返回内容。它将值打印到标准输出通道,并返回<code>None</code>。你知道吗</p>
<p>如果希望<code>re</code>包含错误消息,则需要分配它,如:</p>
<pre><code>try:
netconnect = ConnectHandler(**devices)
except AuthenticationException:
<b>re = 'Authentication failed {}'.format(ipInsert)</b>
print(re)
return render(request,'first_app/forms.html', {'form': form, 'reprinting':re})</code></pre>
<p>请注意,您应该检查:</p>
<pre><code>{% if <b>request.method == 'POST'</b> %}
{% endif %}</code></pre>
<p>因为POST请求可以为空,但它仍然是POST请求。你知道吗</p>