search

Home  >  Q&A  >  body text

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

高洛峰高洛峰2820 days ago598

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 09:25:20

    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.
    

    reply
    0
  • PHPz

    PHPz2017-04-18 09:25:20

    Try the following code:

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

    I don’t know what platform you are using curl -h Take a look at the parameter settings

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:25:20

    For example, are there any difficulties in using the standard library? Do you need system calls? When calling curl through subprocess, you have to manually handle various exceptions such as timeout, stderr, stdout, and process return code...urllib

    reply
    0
  • Cancelreply