This is my script
def main(argv):
if len(sys.argv)>1:
for x in sys.argv:
build(x)
if __name__ == "__main__":
main(sys.argv)
so from the command line I write python myscript.py commandlineargument
I want it to skip myscript.py
and simply run commandlineargument
through commandlineargument(n)
so I understand that my for loop doesn't account for this, but how do I make it do that?
main
function takes anargv
parameter, it should probably use that parameter, rather than ignoring it and usingsys.argv
instead… – Pugilismif
check at all. If there are no arguments, the loop will successfully run 0 times, so let it do so. – Pugilism