P
Peter Hansen
Greetings.
Im trying to write a program that can be run from the command line.
If I want to search for example after a file with the ending .pdf, I should
be able to write in the command line:
python name of my program / the libary to search and what kind of file it
is example a .pdf file
So if my program name was test.py and the library name was library1 and the
test type i wanted to find was, a .pdf file
I should write python test.py /library1 .pdf
I have to use some of the code below, but im very lost, I know that I have
use os, but not quite sure. Does any have any ideas.....
Thanks all
***
# -*- coding: utf-8 -*-
import sys
def useArgument(arg):
if __name__=="__main__":
"""
python argtest.py arg1 arg2 arg3
"""
if len(sys.argv)!=4:
sys.exit("Error, not the right amout of arguments")
for arg in sys.argv:
useArgument(arg)
***
Im trying to write a program that can be run from the command line.
If I want to search for example after a file with the ending .pdf, I should
be able to write in the command line:
python name of my program / the libary to search and what kind of file it
is example a .pdf file
So if my program name was test.py and the library name was library1 and the
test type i wanted to find was, a .pdf file
I should write python test.py /library1 .pdf
I have to use some of the code below, but im very lost, I know that I have
use os, but not quite sure. Does any have any ideas.....
Thanks all
***
# -*- coding: utf-8 -*-
import sys
def useArgument(arg):
if __name__=="__main__":
"""
python argtest.py arg1 arg2 arg3
"""
if len(sys.argv)!=4:
sys.exit("Error, not the right amout of arguments")
for arg in sys.argv:
useArgument(arg)
***