Heim  >  Fragen und Antworten  >  Hauptteil

linux - python调用系统rm命令,无法识别通配符吗?

我想删除目录下所有的*.ts,os.remove无法批量删除

PHP中文网PHP中文网2741 Tage vor366

Antworte allen(2)Ich werde antworten

  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:20:30

    >>> args = [ 'rm *.ts' ]
    >>> p = subprocess.call(args, shell=True)
    

    参考:

    1. http://stackoverflow.com/ques...

    2. http://stackoverflow.com/ques...

    Antwort
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:20:30

    可能要写绝对路径

    Antwort
    0
  • StornierenAntwort