python调用系统命令出现的多余数据

查看:114
本文介绍了python调用系统命令出现的多余数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

我用这个代码subprocess.check_output(["curl cip.cc"],shell=True)调用的时候会出现图中的这些信息,怎么移除呢?不让他显示出来

解决方案

subprocess.check_output(["curl -s cip.cc"],shell=True)

man curl

   -s, --silent
          Silent or quiet mode. Don't show progress meter or error messages.  Makes Curl mute. It will still output the data you ask for, potentially even to the terminal/stdout unless you redirect it.

这篇关于python调用系统命令出现的多余数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆