How to run a python with arguments that would contain spaces? I am using MacOS
For example,
>python testProgram.py argument 1 argument 2
where “argument 1” is a single argument?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ve basically answered your own question there,
"argument 1"is indeed a single argument.In other words, you need to quote it, something like one of:
This isn’t actually a Python issue however, it depends on the shell that you’re using to run the Python script.
For example, with
bash, there are differences between the single and double quotes, the most important of which is probably the various expansions like$HOME– the single quoted variant does not do those expansions.