python subprocess calling bash script - need to print the quotes out too

前端 未结 3 681
你的背包
你的背包 2021-01-19 05:52

I\'m having a problem with subprocess and printing quotes.

My Python script takes user input, mashes it around a bit - and I need it to send it\'s results to a bash

3条回答
  •  太阳男子
    2021-01-19 06:18

    I haven't checked why this works, but it does and without the need for shell=True.

    subprocess.Popen(["/bin/bash", "myscript.sh", '""' + string_to_be_quoted + '""', path_to_files])
    

提交回复
热议问题