if len(sys.argv) != 2:
filename, lang = sys.argv[1], None
print (filename)
elif len(sys.argv) == 4 and sys.argv[1] == '-l':
filename, lang = sys.argv[3], sys.argv[2]
else:
sys.stderr.write('Usage: python pytesseract.py [-l lang] input_file\n')
I can't understand all of this code. Can you explain to me?
sys.argv
is a list of arguments passed to python for executing a file with a specific amount of values passed to it.
See here for more info : https://docs.python.org/3/library/sys.html