Running Bash commands in Python

前端 未结 10 1685
礼貌的吻别
礼貌的吻别 2020-11-21 05:16

On my local machine, I run a python script which contains this line

bashCommand = \"cwm --rdf test.rdf --ntriples > test.nt\"
os.system(bashCommand)
         


        
10条回答
  •  梦谈多话
    2020-11-21 05:41

    You can use subprocess, but I always felt that it was not a 'Pythonic' way of doing it. So I created Sultan (shameless plug) that makes it easy to run command line functions.

    https://github.com/aeroxis/sultan

提交回复
热议问题