Passing variables to a subprocess call

后端 未结 6 2052
予麋鹿
予麋鹿 2020-12-04 22:00

I am trying to pass my variables from raw_input to my subprocess command. I am new to Python. Any help would he appreciated.

#!/usr/bin/python
         


        
6条回答
  •  长情又很酷
    2020-12-04 22:24

    You can also use f-strings.

     import subprocess
    
     site = 'google.com'
     subprocess.run(['nslookup', f'{site}'])
    

提交回复
热议问题