Forum Discussion
Anonymous
3 years agoIt works on my Python datasources simply by putting the argument in quotes. I'm using argparse instead of sys.argv. Maybe that makes the difference?
You could move whatever might have spaces to the end, then parse your arguments from left to right, knowing that when you get to the Nth argument, everything after it should be joined back together:
# ~$ python3 test.py 16353583 abracadabra This is one argument import sys arguments = sys.argv print(f"All arguments: {arguments}") print(f"Argument 1: {arguments[1]}") print(f"Argument 2: {arguments[2]}") print(f"Argument 3: {' '.join(arguments[3:])}")
Related Content
- 3 months ago
- 7 months ago
- 8 months ago