Accepting command line arguments in python scripts
Post by Blake
Since it's not quite as obvious as it is in other languages like Java and C# where the main function always accepts a string array, I figured it was worth mentioning. And also a really cheap blog post:
That's all there is to it. The string array is stashed in .argv under the sys module.
import sys
args = sys.argv
args = sys.argv
That's all there is to it. The string array is stashed in .argv under the sys module.
You must be logged in to post comments.




