I'm pretty much a complete newbie when it comes to Python, and googling this leads to a lot of information about parameters... but not this specific question.
But here's the question: Is there an easy way to make a Python script require a variable when called from outside the script (e.g. Bash)? I realize I can just test on sys.argv, but it really seems like a clunky solution.
For example, could I construct this script so sys.argv[1] has to be passed to use the script without doing tests on it here?:
#!/usr/bin/env python
import string
import random
import sys
def RandomString(length=6):
x=''.join(random.choice(string.ascii_uppercase) for i in range(length))
return x
random.seed(sys.argv[1])
y=RandomString()
print y