1

I have 3 arguments to give to my program but python recognizes more than 3. Ex :

./myprogram "fist argument" "second argument" "thrid one"

So sys.argv[1] will be - "first and sys.argv[2] will be argument

How can I have 3 only strings?
like string1 = "fist argument" ect..

1 Answers1

0

You really shouldn't be using spaces for the argument, as it is the delimiter for command line arguments. Consider using quotes to enclose the argument, or, in a hacky way, for example, merge the first two strings to get the first argument, and so on.

Also, i believe this was already answered here.

Márcio Coelho
  • 333
  • 3
  • 11