arcade16 arcade16 - 3 months ago 5
Python Question

User input in subprocess call?

I am working to automate the Wig tool in python, which will involve including a URL.

Currently I take in user input (a URL) but am having difficulty adding it to the end of the subprocess call.

import subprocess

var = raw_input("Enter a URL: ")'python3 ', var)

I know this is probably a simple question, but any help would be appreciated!


Pass the arguments as a list as @PadraicCunningham suggests:

args = ['python3','']

If your argument list becomes long and complicated you can bring in shlex:

import shlex
args = shlex.split('python3 {}'.format(var))