Programming/Python | Posted by 알 수 없는 사용자 2008. 6. 23. 12:13

command Line Arguments

sys.argv
is an array that contains the command-line arguments passed to the program

for example,
>> python file2DIC -f CityU.utf8.seg -d CityU.DIC

then the value of sys.argv is :
sys.argv [ 0 ] = "file2DIC"
sys.argv [ 1 ] = "-f"
sys.argv [ 2 ] = "CityU.utf8.seg"
sys.argv [ 3 ] = "-d"
sys.argv [ 4 ] = "CityU.DIC"

remember, if you'd like to use it in python, don't forget to add the following lines in your programming:
import sys