سؤال

how can I please have argument with white space? I'm using script from

http://www.tutorialspoint.com/python/python_command_line_arguments.htm

I'm creating a program for downloading subtitles from web. I have [-m[name of the movie]] argument with my script. The getopts from the site mentioned earlier does not count with white space opt argument.

For example: After -m The Mists I need to save "The Mists" into the variable. The problem is when I use the white space program end because of except expression in the code.

How can I please modify it to save the whole "The Mists" into the variable?

Thanks for answers!

هل كانت مفيدة؟

المحلول

It is a function of the shell to parse out individual arguments for you; the majority of shells and consoles use quotes to delimit a single argument with spaces in it:

-m "The Mists"

Python is passed '-m' and 'The Mists' as two separate arguments in such shells.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top