我想删除 Jupyter“运行单元格|运行所有单元格”注释,如果 Visual Studio 代码中存在语法 #%%,则会出现该注释。
有没有控制它的设置?
谢谢你。
我正在使用 python Fabric 中的 run 命令远程执行脚本。
C = fabric.Connection('ip', user='user', connect_kwargs={"password": "password"})
try:
r = C.run('python3 ~/script.py')
if r:
print('{} SUCCESS'.format(C.host))
break
else:
print('{} ERROR'.format(C.host))
break
except:
print('{} ERROR'.format(C.host))
Run Code Online (Sandbox Code Playgroud)
我的 script.py 是:
def download_file(url, filename):
try:
response = requests.get(url)
# Open file and write the content
with open(filename, 'wb') as file:
# A chunk of 128 bytes
for chunk in response:
file.write(chunk)
return 1
except requests.exceptions.RequestException as e:
return 0
download_file(url,filename)
Run Code Online (Sandbox Code Playgroud)
当我执行 run 命令时,有没有办法查看我的函数中返回了哪个值,1 还是 0?
谢谢你!